Skip to content

ci: add cron to auto remove stale branches #1348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
May 7, 2025
24 changes: 24 additions & 0 deletions .github/workflows/remove-stale-branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Remove Stale Branches

on:
schedule:
- cron: "0 0 * * *" # Everday at midnight
workflow_dispatch: # Allows manual trigger from GitHub UI

permissions:
contents: write

jobs:
remove-stale-branches:
runs-on: ubuntu-latest
steps:
- uses: fpicalausa/[email protected]
with:
dry-run: false # Check out the console output before setting this to false
exempt-authors-regex: "^dependabot"
days-before-branch-stale: 90
days-before-branch-delete: 7
operations-per-run: 100
exempt-branches-regex: "^(main|release-dev/.*|v[0-9]+\\.[0-9]+\\.[0-9]+)$"
ignore-unknown-authors: true
default-recipient: "bowenli86"
20 changes: 20 additions & 0 deletions MAINTENANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,26 @@ When merging a complete `release-dev` branch into `main` after a major feature i
- **Breaking Changes**: Clearly document any breaking changes in PR descriptions


### Auto Remove Stale Branches

Many stale branches lives in the repo and never got cleaned up. to balance developer convenience vs being organized/legible, we have implemented a CI workflow to identify and remove stable branches.

The CI workflow will:

- scan stale branches that not hv new commits since 90 days ago, and notify owner if there's one
- if still no changes coming in, delete the stable branch 7 days later

Following branches and regex are excluded

- `main`
- `release-dev/*` (release development branches)
- `v*.*.*` (release branches)

Regex rules can be changed by modifying `exempt-branches-regex` config in the [yml](https://github.com/Layr-Labs/eigenlayer-contracts/blob/main/.github/workflows/remove-stale-branches.yml)


------


## Release Management

Expand Down