Skip to content

Commit

Permalink
chore: add demo workflow, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrgm committed Jan 17, 2024
1 parent 65a84e3 commit d2e05c9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
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

0 comments on commit d2e05c9

Please sign in to comment.