The repo has accumulated a lot of branches that are fully merged into dev/main and no longer serve any purpose. Right now the following are already merged into both and are safe to delete immediately:
@profvjreddi, could you delete these (or grant delete access to whoever manages the repo) when you get a chance? Deleting a merged branch is safe since every commit already lives on dev/main.
What this PR adds
To stop this from recurring, this adds .github/workflows/infra-cleanup-stale-branches.yml, which weekly (Monday 4am UTC) finds branches that are:
fully merged into dev
inactive for 14+ days (configurable)
not main, dev, or gh-pages
and deletes them. It also supports workflow_dispatch with a dry_run toggle so it can be tested or run on demand before trusting the schedule.
This only ever touches branches whose commits are already an ancestor of dev, so it cannot lose work.
Test plan
Run the workflow manually via workflow_dispatch with dry_run: true to confirm the candidate list matches the branches above
Run once for real and confirm the listed branches are removed
Confirm protected branches (main, dev, gh-pages) and open-PR branches are untouched
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/harvard-edge/cs249r_book/pull/1956
**Author:** [@Shashank-Tripathi-07](https://github.com/Shashank-Tripathi-07)
**Created:** 7/9/2026
**Status:** 🔄 Open
**Base:** `dev` ← **Head:** `chore/cleanup-stale-branches`
---
### 📝 Commits (1)
- [`d75f5e3`](https://github.com/harvard-edge/cs249r_book/commit/d75f5e3675d3527e21ee9464dbd2d4271b23e682) chore: add workflow to auto-delete stale merged branches
### 📊 Changes
**1 file changed** (+90 additions, -0 deletions)
<details>
<summary>View changed files</summary>
➕ `.github/workflows/infra-cleanup-stale-branches.yml` (+90 -0)
</details>
### 📄 Description
## Why
The repo has accumulated a lot of branches that are fully merged into `dev`/`main` and no longer serve any purpose. Right now the following are already merged into both and are safe to delete immediately:
```
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 delete access to whoever manages the repo) when you get a chance? Deleting a merged branch is safe since every commit already lives on `dev`/`main`.
## What this PR adds
To stop this from recurring, this adds `.github/workflows/infra-cleanup-stale-branches.yml`, which weekly (Monday 4am UTC) finds branches that are:
- fully merged into `dev`
- inactive for 14+ days (configurable)
- not `main`, `dev`, or `gh-pages`
and deletes them. It also supports `workflow_dispatch` with a `dry_run` toggle so it can be tested or run on demand before trusting the schedule.
This only ever touches branches whose commits are already an ancestor of `dev`, so it cannot lose work.
## Test plan
- [ ] Run the workflow manually via `workflow_dispatch` with `dry_run: true` to confirm the candidate list matches the branches above
- [ ] Run once for real and confirm the listed branches are removed
- [ ] Confirm protected branches (`main`, `dev`, `gh-pages`) and open-PR branches are untouched
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/harvard-edge/cs249r_book/pull/1956
Author: @Shashank-Tripathi-07
Created: 7/9/2026
Status: 🔄 Open
Base:
dev← Head:chore/cleanup-stale-branches📝 Commits (1)
d75f5e3chore: add workflow to auto-delete stale merged branches📊 Changes
1 file changed (+90 additions, -0 deletions)
View changed files
➕
.github/workflows/infra-cleanup-stale-branches.yml(+90 -0)📄 Description
Why
The repo has accumulated a lot of branches that are fully merged into
dev/mainand no longer serve any purpose. Right now the following are already merged into both and are safe to delete immediately:@profvjreddi, could you delete these (or grant delete access to whoever manages the repo) when you get a chance? Deleting a merged branch is safe since every commit already lives on
dev/main.What this PR adds
To stop this from recurring, this adds
.github/workflows/infra-cleanup-stale-branches.yml, which weekly (Monday 4am UTC) finds branches that are:devmain,dev, orgh-pagesand deletes them. It also supports
workflow_dispatchwith adry_runtoggle so it can be tested or run on demand before trusting the schedule.This only ever touches branches whose commits are already an ancestor of
dev, so it cannot lose work.Test plan
workflow_dispatchwithdry_run: trueto confirm the candidate list matches the branches abovemain,dev,gh-pages) and open-PR branches are untouched🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.