DOC-343: Add stale-branch cleanup script and workflow - #935
Open
quetzalliwrites wants to merge 1 commit into
Open
DOC-343: Add stale-branch cleanup script and workflow#935quetzalliwrites wants to merge 1 commit into
quetzalliwrites wants to merge 1 commit into
Conversation
Delete-on-merge is already enabled, so this targets the backlog of already-merged branches from before that setting existed, plus ongoing cleanup for closed-but-unmerged PRs. scripts/delete-stale-branches.sh classifies every non-default branch: - Skipped: the default branch and any branch that is the head of an open PR. - Eligible for deletion: head of a merged PR (any age), or head of a closed-unmerged PR older than --days (default 90). - Reported only, never auto-deleted: no associated PR at all and older than --days, since this may be unpushed personal work rather than an abandoned PR branch. Defaults to a dry run; --execute (with a typed confirmation, or --yes for non-interactive/CI use) is required to actually delete anything. .github/workflows/cleanup-stale-branches.yml runs it as a weekly dry-run report (workflow_dispatch or schedule), and lets a maintainer trigger an actual cleanup by checking "execute" on a manual run. Verified against the live repo in dry-run mode: 310 branches fetched, 273 eligible (mostly merged), 8 flagged for manual review, and none of the branches behind currently open PRs were touched. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
quetzalliwrites
requested review from
HarshCasper and
remotesynth
as code owners
September 9, 2026 20:08
Deploying localstack-docs with
|
| Latest commit: |
944ffde
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6a36ba7e.localstack-docs.pages.dev |
| Branch Preview URL: | https://doc-343-docs-delete-stale-he.localstack-docs.pages.dev |
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.
Summary
Delete-on-merge is already enabled for this repo, so the remaining problem is the existing backlog of stale head branches from before that setting existed (plus ongoing cleanup of closed-but-unmerged PRs).
scripts/delete-stale-branches.sh: fetches every branch via the GitHub GraphQL API along with its last commit date and most recently updated associated PR, then classifies it:--days(default 90).--days— this may be someone's unpushed personal work rather than an abandoned PR branch, so it's flagged for manual review instead.--execute, plus either a typeddeleteconfirmation or--yesfor non-interactive/CI use..github/workflows/cleanup-stale-branches.yml: runs the script as a weekly dry-run report (schedule), and lets a maintainer trigger a real cleanup viaworkflow_dispatchwith theexecuteinput checked.Verified against the live repo in dry-run mode: 310 branches fetched, 273 eligible (mostly merged PRs from before delete-on-merge was enabled), 8 flagged for manual review, and confirmed none of the branches behind currently open PRs were touched.
Linear ticket
https://linear.app/localstack/issue/DOC-343/docs-delete-stale-head-branches-in-github-docs-repo
Test plan
bash -n scripts/delete-stale-branches.sh(syntax check)localstack/localstack-docsand reviewed the full outputnpx astro buildstill completes successfully (these files aren't part of the content collection)Note
Haven't run
--executeyet, want a maintainer to skim the dry-run output (or re-run it) before we actually delete 273 branches.