Skip to content

Handle Stale PRs, Issues and Branches #779

Handle Stale PRs, Issues and Branches

Handle Stale PRs, Issues and Branches #779

Workflow file for this run

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/stale@v9.0.0
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/checkout@v4.2.1
- name: Delete Old Branches
uses: beatlabs/delete-old-branches-action@v0.0.10
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