Skip to content

chore: clean up stale merged branches, add auto-cleanup workflow - #1956

Closed
Shashank-Tripathi-07 wants to merge 1 commit into
harvard-edge:devfrom
Shashank-Tripathi-07:chore/cleanup-stale-branches
Closed

chore: clean up stale merged branches, add auto-cleanup workflow#1956
Shashank-Tripathi-07 wants to merge 1 commit into
harvard-edge:devfrom
Shashank-Tripathi-07:chore/cleanup-stale-branches

Conversation

@Shashank-Tripathi-07

@Shashank-Tripathi-07 Shashank-Tripathi-07 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Problem

Merged branches never get cleaned up, so the repo has accumulated a pile of dead branches with no way forward.

Fix

Adds .github/workflows/infra-cleanup-stale-branches.yml: weekly, deletes any branch that's fully merged into dev and inactive 14+ days. Skips main, dev, gh-pages. Supports workflow_dispatch with a dry_run toggle for manual testing.

Only ever deletes branches whose commits are already an ancestor of dev, so it can't lose work.

Also included

30 branches already merged and safe to delete right now:

chore/precommit-cleanup, chore/staffml-ci-path, cleanup/book-validate-paths,
feat/container-preflight-urls, fix/badge-fixes, fix/callout-flow,
fix/staffml-reusable-concurrency, fix/staffml-trigger-on-workflow-edits, fmt-fix,
kai/clarify-community-map-totals, vol1/ch1-pass4, vol1/ch10-pass3, vol1/ch11-pass3,
vol1/ch12-pass3, vol1/ch13-pass3, vol1/ch14-pass3, vol1/ch2-final, vol1/ch2-pass3,
vol1/ch3-final, vol1/ch4-final, vol1/ch5-final, vol1/ch5-pass2, vol1/ch5-pass4,
vol1/ch6-pass4, vol1/ch7-pass3, vol1/ch8-final, vol1/ch8-pass3, vol1/ch9-final,
vol1/ch9-pass3, vol1/frontmater-final, vol1/frontmatter

@profvjreddi could you delete these (or grant access) when you get a chance?

Test plan

  • workflow_dispatch with dry_run: true, confirm candidate list matches above
  • Run for real, confirm branches removed
  • Confirm main/dev/gh-pages and open-PR branches untouched

@github-actions github-actions Bot added area: tools Build tools, scripts, CI/CD type: improvement Improve existing content labels Jul 9, 2026
@Shashank-Tripathi-07 Shashank-Tripathi-07 self-assigned this Aug 6, 2026
@Shashank-Tripathi-07

Copy link
Copy Markdown
Collaborator Author

I read this and went through this. Even though the idea I proposed earlier is quite right. We need to clean branches that are not deleted after their code is merged. But this hinders a lot of future workflows that we'll be building. I want to keep the future workflow launches smooth and don't want them to get into any trouble. I would insist in all maintainers having the attitude of deleting branches once their code is merged.

@Shashank-Tripathi-07
Shashank-Tripathi-07 deleted the chore/cleanup-stale-branches branch August 7, 2026 00:44
@Shashank-Tripathi-07

Copy link
Copy Markdown
Collaborator Author

Closed and branch deleted as required. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tools Build tools, scripts, CI/CD type: improvement Improve existing content

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant