Skip to content

Automate safe merged-branch cleanup - #158

Merged
ByBrawe merged 4 commits into
mainfrom
chore/branch-hygiene
Sep 21, 2026
Merged

ByBrawe merged 4 commits into
mainfrom
chore/branch-hygiene

Conversation

@ByBrawe

@ByBrawe ByBrawe commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Add branch hygiene that removes stale same-repository branches without rebasing or re-merging old squash-merged work.

Safety rules:

  • never delete the default branch or a protected branch;
  • never delete a branch that backs an open PR;
  • only consider same-repository merged PRs;
  • require the merged PR's recorded head SHA to exactly equal the branch's current SHA;
  • re-read the git ref immediately before deletion and skip it if the SHA changed;
  • retain closed-unmerged diagnostics/experiments for manual review.

PRs run the planner read-only with BRANCH_HYGIENE_DRY_RUN=1; cleanup is skipped. Pushes to main and manual runs use a separate write-enabled cleanup job. The current dry-run scanned 227 branches and found 105 exact merged-head candidates while retaining 120 unmatched branches and the open-PR branch.

Merging this PR performs the first historical sweep and future main updates keep merged branch debt from accumulating.

Copilot AI lite review requested due to automatic review settings September 21, 2026 18:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ByBrawe
ByBrawe merged commit 37261a9 into main Sep 21, 2026
10 checks passed
@github-actions
github-actions Bot deleted the chore/branch-hygiene branch September 21, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants