Handle Stale PRs, Issues and Branches #773
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Handle Stale PRs, Issues and Branches | |
on: | |
schedule: | |
# Run everyday at 1 AM | |
- cron: '0 1 * * *' | |
workflow_dispatch: | |
jobs: | |
prs: | |
name: Clean Up Stale PRs and Issues | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/[email protected] | |
with: | |
repo-token: ${{ secrets.PAT }} | |
operations-per-run: 200 | |
stale-pr-message: 'This PR is considered to be stale. It has been open for 20 days with no further activity thus it is going to be closed in 7 days. To avoid such a case please consider removing the stale label manually or add a comment to the PR.' | |
stale-issue-message: 'This issue is considered to be stale. It has been open for 30 days with no further activity thus it is going to be closed in 7 days. To avoid such a case please consider removing the stale label manually or add a comment to the issue.' | |
days-before-pr-stale: 20 | |
days-before-pr-close: 7 | |
days-before-issue-stale: 30 | |
days-before-issue-close: 7 | |
stale-pr-label: 'Stale' | |
stale-issue-label: 'Stale' | |
branches: | |
name: Cleanup Stale Branches | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Delete Old Branches | |
uses: beatlabs/[email protected] | |
with: | |
repo_token: ${{ secrets.PAT }} | |
date: '3 months ago' | |
dry_run: false | |
delete_tags: false | |
extra_protected_branch_regex: ^(main|develop)$ | |
exclude_open_pr_branches: true |