ci: deploy db migrations and edge functions in one workflow#32
Merged
Conversation
Splits db-migrate into two reusable sub-workflows (_db_migrate, _deploy_edge_functions) orchestrated by deploy.yml. PRs deploy to staging; pushes to main deploy to prod. paths-filter skips jobs when the relevant files weren't touched.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Replaces the standalone db-migrate.yml workflow with a single orchestrator (deploy.yml) that calls two reusable sub-workflows (_db_migrate.yml and _deploy_edge_functions.yml), so a single workflow run handles both DB migrations and edge function deploys (staging for PRs, prod for pushes to main).
Changes:
- Adds
deploy.ymlorchestrator that resolves the target environment, usesdorny/paths-filterto detect which sub-workflows to run, and posts/updates a combined PR status comment. - Adds reusable workflows
_db_migrate.ymland_deploy_edge_functions.yml, each taking atargetinput and selecting the corresponding project ref/secrets. - Removes the legacy
db-migrate.ymlworkflow.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| .github/workflows/deploy.yml | New orchestrator: resolves target, runs path-filter, calls sub-workflows, posts combined PR comment. |
| .github/workflows/_db_migrate.yml | New reusable workflow that links Supabase and pushes migrations for the given target. |
| .github/workflows/_deploy_edge_functions.yml | New reusable workflow that deploys Supabase edge functions for the given target. |
| .github/workflows/db-migrate.yml | Removed; functionality folded into the orchestrator + reusable migrate workflow. |
|
Deploy →
|
chiptus
commented
May 16, 2026
- Validate target input in reusable workflows (workflow_call doesn't support type: choice) - Drop pinned supabase-cli version, let setup-cli auto-resolve from package.json - Extract PR comment logic to .github/scripts/post-deploy-comment.sh
setup-cli auto-detect resolved to v2.20.3 in CI despite package.json declaring ^2.58.5, so the auto-resolution is unreliable. Re-pinning to 2.58.5 explicitly.
5 tasks
Each PR run wipes the staging DB and reapplies all migrations from source. Avoids drift when parallel PRs add different migrations to a shared staging environment. Three layers ensure prod can never hit this path: - step gated on inputs.target == 'staging' - guard that aborts if STAGING_PROJECT_REF == PROD_PROJECT_REF - reset step only references STAGING_* vars/secrets
Reverts the auto-reset on staging. Instead, when the migrate job fails on a PR, the status comment now includes instructions for manually resetting and re-seeding staging via supabase db reset + db:sync:staging.
- environment: only resolves to 'production' or 'staging' for valid inputs; invalid values yield empty string and fail the job before any step runs (no accidental secret exposure) - comment job now requires needs.resolve.result == 'success' so it doesn't run with empty TARGET when target resolution fails
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Splits the old
db-migrateworkflow into two reusable sub-workflows orchestrated bydeploy.yml, so PRs deploy migrations and edge functions to staging (and pushes tomainto prod) in one place.Generated by Claude Code