Skip to content

Commit 24e1fed

Browse files
authored
Implement Stale Issue Handling (#2150)
Use `actions/stale` to perform the following actions twice daily: - Mark issues that haven't been touched for 1 year as stale. - Close issues that have been marked stale for 30 days without an update.
1 parent 1ab92db commit 24e1fed

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/stale.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: 'Stale: Label and Close Issues'
2+
on:
3+
schedule:
4+
- cron: '23 2,14 * * *' # Twice daily at 19 minutes after the hour (random/uncommon time)
5+
6+
workflow_dispatch:
7+
# Manual triggering through the GitHub UI, API, or CLI
8+
inputs:
9+
daysBeforeStale:
10+
required: true
11+
default: "365"
12+
daysBeforeClose:
13+
required: true
14+
default: "30"
15+
operationsPerRun:
16+
required: true
17+
default: "4000"
18+
19+
permissions:
20+
actions: write # For managing the operation state cache
21+
issues: write
22+
23+
jobs:
24+
stale:
25+
if: github.repository_owner == 'microsoft' # Do not run on forks
26+
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/stale@v9 # https://github.com/actions/stale/blob/v9/README.md
30+
with:
31+
ascending: true # Process the oldest issues first
32+
stale-issue-label: 'stale'
33+
stale-issue-message: "Due to lack of recent activity, this issue has been labeled as 'stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label."
34+
close-issue-message: "This issue will now be closed since it has been labeled 'stale' without activity for 30 days."
35+
days-before-stale: ${{ fromJson(inputs.daysBeforeStale || 2192) }} # Default to 6 years if not specified as input
36+
days-before-close: ${{ fromJson(inputs.daysBeforeClose || 30 ) }} # Default to 30 days if not specified as input
37+
days-before-pr-stale: -1 # Do not label PRs as 'stale'
38+
days-before-pr-close: -1 # Do not close PRs labeled as 'stale'
39+
operations-per-run: ${{ fromJson(inputs.operationsPerRun || 4000 )}}

0 commit comments

Comments
 (0)