[FEATURE REQUEST] Automatically label and close stale PRs
- Dominant language
- CSS
- Stars
- 11.8k
- Forks
- 2.4k
- Avg merge
- 5d 9h
- Merged PRs (30d)
- 4
Description
### I have searched through the issues and didn't find my problem.
- [X] Confirm
### Problem
We have a stale label that we manually assign to PRs after approximately 1 month of inactivity. After another month or so has passed, we manually close the PR.
We should add the following automatic behaviour:
- Automatically label PRs as stale after 1 or 2 month of inactivity.
- Automatically close PRs 1 month after they've been labeled stale.
### Possible Solution
Using the [stale](https://github.com/actions/stale) action we can automate both labeling and closing stale PRs. If we want it can also label and close stale issues. I recommend we do both.
Here's an example workflow we could use (based on [this tutorial](https://docs.github.com/en/actions/managing-issues-and-pull-requests/closing-inactive-issues))
```yml
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"
jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v5
with:
days-before-issue-stale: 120
days-before-issue-close: 14
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 120 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
days-before-pr-stale: 60
days-before-pr-close: 30
stale-pr-message: "This PR is stale because it has been open for 60 days with no activity."
close-pr-message: "This PR was closed because it has been inactive for 30 days since being marked as stale."
repo-token: ${{ secrets.GITHUB_TOKEN }}
```
### Additional information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.