Skip to content

Stale Branches Cleanup Running #1

Stale Branches Cleanup Running

Stale Branches Cleanup Running #1

# .github/workflows/cleanup-stale-branch.yaml
name: Cleanup Stale Branches
run-name: Stale Branches Cleanup Running
on:
# Allows to run workflow manually from the Actions tab
workflow_dispatch:
schedule:
# Runs at 4:00 AM every day (Monday to Sunday)
- cron: '0 4 * * *'
permissions:
contents: write
actions: read
pull-requests: read
jobs:
cleanup_stale_branches:
# Only run if the repository is not a fork and not archived
if: github.event.repository.fork == false && github.event.repository.archived == false
runs-on: ubuntu-latest
steps:
- name: Cleanup Stale Branches
uses: fpicalausa/remove-stale-branches@7c4f2afe88a36c0f9114cd958380979b9d7323fb
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
days-before-branch-stale: 90
days-before-branch-delete: 30
operations-per-run: 50
dry-run: false
ignore-branches-with-open-prs: true
stale-branch-message: |
Dear @{author}, Your branch [{branchName}]({branchUrl}) has not been updated in the last {daysBeforeBranchStale} days and is marked as stale. It will be removed in {daysBeforeBranchDelete} days.
If you want to keep this branch around, delete this comment or add new commits to this branch.
exempt-branches-regex: '^(main|master|dependabot/.*|release/.*)$'