Skip to content

Commit e68fb48

Browse files
authored
Merge pull request #1228 from jest-community/test-stale-action
update stale script to improve issue life-cycle management
2 parents d8ac781 + 8268c30 commit e68fb48

File tree

1 file changed

+69
-26
lines changed

1 file changed

+69
-26
lines changed

.github/workflows/stale.yml

Lines changed: 69 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,78 @@
1-
name: Mark stale issues and auto close if inactive
1+
name: Manage Stale, Legacy, and Close Issues
22

33
on:
4-
# schedule:
5-
# - cron: "30 1 * * *"
6-
7-
# debugging
8-
workflow_dispatch:
4+
# Uncomment the schedule below to run automatically, or trigger manually with workflow_dispatch.
5+
# schedule:
6+
# - cron: '0 4 * * *' # 04:00 UTC
7+
# - cron: '30 5 * * *' # 05:30 UTC
8+
9+
workflow_dispatch:
910

1011
jobs:
11-
stale:
12-
12+
# ----------------------------------------------------------------------------
13+
# Job: stale-issues
14+
# Summary:
15+
# Marks open issues as "stale" if they have had no activity for 1 year (365 days),
16+
# and then closes issues that remain stale for 30 days,
17+
# unless they carry exempt labels such as "pinned", "security", or "keep-alive".
18+
# ----------------------------------------------------------------------------
19+
stale-issues:
1320
runs-on: ubuntu-latest
1421
permissions:
1522
issues: write
23+
steps:
24+
- name: Manage stale issues
25+
uses: actions/stale@v9
26+
with:
27+
repo-token: ${{ secrets.GITHUB_TOKEN }}
28+
days-before-issue-stale: 365
29+
days-before-pr-stale: -1
30+
days-before-issue-close: 30
31+
days-before-pr-close: -1
32+
stale-issue-label: 'stale'
33+
close-issue-label: 'auto-closed'
34+
stale-issue-message: >
35+
This issue has been inactive for over a year and has been marked as stale.
36+
It will be automatically closed in 30 days if no further activity occurs.
37+
Since significant changes have occurred in the codebase, please open a new issue
38+
with updated details if the problem still persists.
39+
close-issue-message: >
40+
This issue is being automatically closed due to prolonged inactivity.
41+
If you believe this issue is still relevant, please open a new issue with updated details.
42+
exempt-issue-labels: 'pinned,security,keep-alive'
43+
debug-only: false
44+
enable-statistics: true
45+
remove-stale-when-updated: true
46+
operations-per-run: 500
1647

48+
# ----------------------------------------------------------------------------
49+
# Job: mark-legacy-issue
50+
# Summary:
51+
# Marks open issues as "legacy" (using ignore-updates so that only the creation date is considered)
52+
# if they were created over 2 years (730 days) ago and lack exempt labels like "pinned" or "security".
53+
# ----------------------------------------------------------------------------
54+
mark-legacy-issue:
55+
runs-on: ubuntu-latest
56+
permissions:
57+
issues: write
1758
steps:
18-
- uses: actions/stale@v3
19-
with:
20-
repo-token: ${{ secrets.GITHUB_TOKEN }}
21-
22-
stale-issue-label: 'stale'
23-
stale-issue-message: 'This issue is marked stale because it has not seen any activity in 365 days. Please let us know if this is still an important issue for you, otherwise it will be automatically closed in 10 days to help us focus on more active issues. Thanks.'
24-
close-issue-message: 'This issue was closed because it has been stalled for over 365 days without any activity.'
25-
days-before-issue-stale: 365
26-
days-before-issue-close: 10
27-
28-
operations-per-run: 500
29-
30-
# debugging
31-
debug-only: true
32-
enable-statistics: true
33-
34-
35-
59+
- name: Mark legacy issues using stale action
60+
uses: actions/stale@v9
61+
with:
62+
repo-token: ${{ secrets.GITHUB_TOKEN }}
63+
ignore-updates: true
64+
days-before-issue-stale: 730
65+
days-before-pr-stale: -1
66+
days-before-issue-close: -1
67+
days-before-pr-close: -1
68+
stale-issue-label: 'legacy'
69+
stale-issue-message: >
70+
This issue was created over 2 years ago and is considered legacy.
71+
Given the extensive changes to the codebase since then, we recommend opening a new issue
72+
with updated details if this problem still affects you.
73+
exempt-issue-labels: 'pinned,security'
74+
debug-only: false
75+
enable-statistics: true
76+
remove-stale-when-updated: false
77+
operations-per-run: 500
78+

0 commit comments

Comments
 (0)