name: Seed manifest guard

on:
  pull_request:
    paths:
      - 'supabase/seeds/**'
      - 'supabase/seed.manifest'
      - 'supabase/combine-seeds.sh'
  push:
    branches:
      - main
      - development
    paths:
      - 'supabase/seeds/**'
      - 'supabase/seed.manifest'
      - 'supabase/combine-seeds.sh'

jobs:
  verify-generated-seed-sql:
    name: Combine seeds and diff committed seed.sql
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0

      - name: Setup workspace
        uses: ./.github/actions/setup-workspace

      - name: Regenerate supabase/seed.sql
        run: pnpm supabase:combine-seeds

      - name: Ensure seed.sql matches manifest output
        run: git diff --exit-code supabase/seed.sql
