Skip to content

feat(ci): close stale PRs automatically #819

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

Merged
merged 1 commit into from
Apr 8, 2025
Merged
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
35 changes: 35 additions & 0 deletions .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Stale"
on:
schedule:
# every night at 01:30
- cron: "30 1 * * *"
# run this workflow if the workflow definition gets changed within a PR
pull_request:
branches: ["main"]
paths: [".github/workflows/stale.yaml"]

env:
DAYS_BEFORE_PR_STALE: 7
DAYS_BEFORE_PR_CLOSE: 7

permissions:
issues: write
pull-requests: write

jobs:
stale:
name: "Stale"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "Mark old PRs as stale"
uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-pr-message: "This PR was marked as stale after ${{ env.DAYS_BEFORE_PR_STALE }} days of inactivity and will be closed after another ${{ env.DAYS_BEFORE_PR_CLOSE }} days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it."
close-pr-message: "This PR was closed automatically because it has been stalled for ${{ env.DAYS_BEFORE_PR_CLOSE }} days with no activity. Feel free to re-open it at any time."
days-before-pr-stale: ${{ env.DAYS_BEFORE_PR_STALE }}
days-before-pr-close: ${{ env.DAYS_BEFORE_PR_CLOSE }}
# never mark issues as stale or close them
days-before-issue-stale: -1
days-before-issue-close: -1
Loading