chore(ci): add workflow to prevent temporary migrations from being merged into main #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Prevent Temporary Migrations on Main | |
| on: | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| block-temp-migrations: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check for temporary migrations | |
| run: | | |
| # Check for any temp migrations (both TEMP and temp) | |
| shopt -s nullglob | |
| temp_migrations=(pkgs/core/supabase/migrations/*_pgflow_TEMP_*.sql pkgs/core/supabase/migrations/*_pgflow_temp_*.sql) | |
| if [ ${#temp_migrations[@]} -gt 0 ]; then | |
| echo "::error::❌ Temporary migrations found! These cannot be merged to main." | |
| echo "::error::Remove all temp migrations and generate a final migration:" | |
| echo "" | |
| echo " git rm -f pkgs/core/supabase/migrations/*_pgflow_TEMP_*.sql" | |
| echo " git rm -f pkgs/core/supabase/migrations/*_pgflow_temp_*.sql" | |
| echo " cd pkgs/core" | |
| echo " ./scripts/atlas-migrate-hash --yes" | |
| echo " ./scripts/atlas-migrate-diff your_feature_name" | |
| echo "" | |
| echo "Found migrations:" | |
| printf '%s\n' "${temp_migrations[@]}" | |
| exit 1 | |
| fi | |
| echo "✅ No temporary migrations found" |