name: Seed workspace
description: Truncate and seed a Tailor Platform workspace with the app's seed data.

# Requires: pnpm install already run. Runs the app's seed:reset script
# (truncate + seed) for a known start state.

inputs:
  token:
    description: "Tailor Platform access token (e.g. the `token` output of erp-kit-fetch-tailor-token)."
    required: true
  workspace_id:
    description: "Tailor workspace ID to seed."
    required: true
  app:
    description: "App name under apps/ (e.g. user-management)."
    required: true

runs:
  using: composite
  steps:
    - name: Seed data
      shell: bash
      env:
        TAILOR_PLATFORM_TOKEN: ${{ inputs.token }}
        TAILOR_PLATFORM_WORKSPACE_ID: ${{ inputs.workspace_id }}
        APP: ${{ inputs.app }}
      run: pnpm -C "apps/$APP/backend" run --silent seed:reset
