Release · v2.16.4
Only delete branches that are also 0 commits ahead…
Only delete branches that are also 0 commits ahead of main
Details
Add a third deletion condition to the cleanup workflow: in addition to (a) has a closed PR and (b) has no open PR, a branch must also be (c) 0 commits ahead of the default branch — i.e. every commit on it is already contained in main. This guarantees no unmerged work is ever discarded: a branch whose PR was closed without merging, or that was squash/rebase-merged and then had new commits pushed, would still carry commits not in main and is now preserved (reported under "commits not in main"). Branches that fail the compare call are also preserved to be safe. Implemented via repos.compareCommitsWithBasehead(main...branch) and checking ahead_by === 0. CLAUDE.md branch-hygiene note updated to match. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pn8V4h9YWbjYzdSrDiLiVL
Files changed (2)
| .github/workflows/cleanup-merged-branches.yml | +46 | −24 |
| CLAUDE.md | +3 | −3 |