Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liatrio/prune-stale-branches-action
A GitHub Action that can be used to prune/cleanup stale and/or unused branches in a repository.
https://github.com/liatrio/prune-stale-branches-action
actions github-actions stale
Last synced: 8 days ago
JSON representation
A GitHub Action that can be used to prune/cleanup stale and/or unused branches in a repository.
- Host: GitHub
- URL: https://github.com/liatrio/prune-stale-branches-action
- Owner: liatrio
- License: mit
- Created: 2024-01-30T21:16:43.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-08-27T15:10:45.000Z (3 months ago)
- Last Synced: 2024-08-27T16:46:20.494Z (3 months ago)
- Topics: actions, github-actions, stale
- Language: TypeScript
- Homepage:
- Size: 1.67 MB
- Stars: 0
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Prune Stale Branches GitHub Action
This repository is home to a GitHub Action that can be used to prune/cleanup stale/unused branches in a repository.
Pruning/cleaning up stale branches reduces overall cognitive overhead. This falls directly in line with the Engineering Defaults defined in [openo11y.dev][0].
## Sample Usage
To use this action in your repository/repositories, simply add a workflow that'll call this action and provide the necessary inputs/config values.
For example, the following snippet is a workflow that will run the Prune Stale Branches Action once day at midnight (`cron: 0 0 * * *`) or whenever manually triggered (`workflow_dispatch`):
```yaml
name: Find & Prune Stale Brancheson:
workflow_dispatch: {}
schedule:
- cron: 0 0 * * *jobs:
prune-stale-branches:
runs-on: ubuntu-latest
steps:
- uses: liatrio/[email protected]
name: Run Prune Stale Branches Action
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
stale-branch-age: 1 month
stale-branch-issue-age: 7 days
```## Reason for Creation
Reducing technical debt and cognitive overhead is essential for effective engineering.
Having tons of stale branches that have diverged from trunk is in-itself technical debt.
This stale action will automatically delete them if not addressed.> Is 1000 open branches indicative of a poor engineering experience? Yes.
>
> One valid opinion on this is to reduce cognitive overhead and by running automation regularly to cleanup branches in the remote. We should POC a bot that:
>
> 1. automatically runs against n number of repos
> 2. checks the time they've been open
> 3. notifies a slack channel that a list of branches having been open longer than the given time are about to be deleted
> 4. deletes them if no[0]: https://openo11y.dev