Skip to content
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

chore: add demo workflow, update readme #1

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/stale-branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Cleanup Stale Branches

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # This schedule runs the workflow at midnight every day

jobs:
cleanup-stale-branches:
runs-on: ubuntu-latest
steps:
- name: Cleanup Stale Branches
uses: cbrgm/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}

12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ Branches that meet all these criteria are considered as stale or abandoned and e
```yaml
name: Cleanup Stale Branches

on: [push]
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # This schedule runs the workflow at midnight every day

jobs:
cleanup-stale-branches:
Expand All @@ -58,8 +61,9 @@ This advanced example includes optional configurations:
name: Cleanup Stale Branches

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Runs at midnight every day
- cron: '0 0 * * *' # This schedule runs the workflow at midnight every day

jobs:
cleanup-stale-branches:
Expand All @@ -70,7 +74,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
ignore-branches: "main,develop,release-*"
ignore-branches: "foobar,release-*"
allowed-prefixes: "feature/,bugfix/"
last-commit-age-days: 60
dry-run: false
Expand All @@ -80,7 +84,7 @@ jobs:
In this advanced example:

* The action is scheduled to run daily.
* It ignores branches starting with `release-`.
* It ignores the branch `foobar` and branches starting with `release-`.
* Only branches prefixed with `feature/` or `bugfix/` are considered for deletion.
* Branches with no commits in the last `60` days are eligible for deletion.
* The action is not in `dry-run` mode, meaning branches will actually be deleted.
Expand Down
Loading