ci: sweep Supabase preview branches older than a week - #1109
Open
charlesyhuang wants to merge 2 commits into
Open
ci: sweep Supabase preview branches older than a week#1109charlesyhuang wants to merge 2 commits into
charlesyhuang wants to merge 2 commits into
Conversation
Supabase caps the project at 50 active branch projects, and a PR that is abandoned or force-closed never runs the teardown that frees its preview branch, so the pool drains until new PRs cannot provision a preview database at all. A daily scheduled job now deletes any non-persistent pr-N branch created more than seven days ago. The threshold and a dry-run mode are overridable on manual dispatch. Deletion is recoverable: the PR's next preview run rebuilds the branch from the prod schema snapshot. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
charlesyhuang
requested review from
RishiDesai,
dot-agi and
pfbyjy
as code owners
August 6, 2026 23:21
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Oddish previewCommit:
Vercel deployment URL: https://oddish-lca8xfpdk.oddish.app Plan:
This comment is updated by the PR Preview workflow. |
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.


Supabase caps the project at 50 active branch projects, and a PR that is abandoned or force-closed never runs the teardown that frees its preview branch, so the pool drains until new PRs cannot provision a preview database at all. This replaces #1054, which tried to recover from the ceiling inline at the moment a PR hit it.
A daily scheduled job now deletes any non-persistent
pr-Nbranch created more than seven days ago; the threshold and a dry-run mode are overridable on manual dispatch. Deletion is recoverable — the PR's next preview run rebuilds the branch from the prod schema snapshot — so a long-lived open PR loses at most one preview rebuild, and an unreadable branch listing fails the sweep before any delete rather than reading as "nothing is stale".Note
Medium Risk
Deletes live preview infrastructure via the Supabase API on a schedule; mistakes in branch name/age filters could remove active PR previews, though scope is limited to
pr-Nnon-persistent branches and branches can be recreated on the next preview run.Overview
Adds a scheduled daily sweep (plus manual
workflow_dispatch) so abandonedpr-NSupabase preview branches are removed before the project hits its 50 active branch limit, instead of trying to recover at provision time.The new
prune_stale_supabase_branches.shlists branches, deletes only non-persistent names matching^pr-[0-9]+$older thanMAX_AGE_DAYS(default 7), supports dry run, validates numeric age, fails the job if anycreated_atis unparseable, continues after individual delete failures, and redirects stdin onsupabase branches deleteso the CLI cannot break the delete loop.preview-prune.ymlwires secrets/vars through jobenv(not interpolated intorun:).test_pr_preview_workflow.pygains workflow contract checks and bash integration tests with a fakesupabaseCLI (filtering, age threshold, dry run, multi-delete regression, timestamp edge cases).Reviewed by Cursor Bugbot for commit 814fa68. Bugbot is set up for automated code reviews on this repo. Configure here.