|
1 |
| -name: "Close stale issues" |
| 1 | +name: "Stale Issue Management" |
2 | 2 | on:
|
3 | 3 | schedule:
|
4 |
| - - cron: "0 0 * * *" |
| 4 | + # Run daily at midnight UTC |
| 5 | + - cron: "0 0 * * *" |
| 6 | + workflow_dispatch: # Allow manual triggering |
| 7 | + |
| 8 | +env: |
| 9 | + # Default stale policy timeframes |
| 10 | + DAYS_BEFORE_STALE: 365 |
| 11 | + DAYS_BEFORE_CLOSE: 30 |
| 12 | + |
| 13 | + # Accelerated timeline for needs-information issues |
| 14 | + NEEDS_INFO_DAYS_BEFORE_STALE: 30 |
| 15 | + NEEDS_INFO_DAYS_BEFORE_CLOSE: 7 |
5 | 16 |
|
6 |
| -permissions: {} |
7 | 17 | jobs:
|
8 | 18 | stale:
|
9 |
| - permissions: |
10 |
| - issues: write # to close stale issues (actions/stale) |
11 |
| - pull-requests: write # to close stale PRs (actions/stale) |
12 |
| - |
13 | 19 | runs-on: ubuntu-latest
|
14 | 20 | steps:
|
15 |
| - - uses: actions/stale@v9 |
16 |
| - with: |
17 |
| - repo-token: ${{ secrets.GITHUB_TOKEN }} |
18 |
| - stale-issue-message: 'This issue is marked stale. It will be closed in 30 days if it is not updated.' |
19 |
| - stale-pr-message: 'This pull request is marked stale. It will be closed in 30 days if it is not updated.' |
20 |
| - days-before-stale: 365 |
21 |
| - days-before-close: 30 |
22 |
| - stale-issue-label: "Stale" |
23 |
| - stale-pr-label: "Stale" |
24 |
| - operations-per-run: 10 |
25 |
| - remove-stale-when-updated: true |
| 21 | + # First step: Handle regular issues (excluding needs-information) |
| 22 | + - name: Mark regular issues as stale |
| 23 | + uses: actions/stale@v9 |
| 24 | + with: |
| 25 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 26 | + |
| 27 | + # Default stale policy |
| 28 | + days-before-stale: ${{ env.DAYS_BEFORE_STALE }} |
| 29 | + days-before-close: ${{ env.DAYS_BEFORE_CLOSE }} |
| 30 | + |
| 31 | + # Explicit stale label configuration |
| 32 | + stale-issue-label: "stale" |
| 33 | + stale-pr-label: "stale" |
| 34 | + |
| 35 | + stale-issue-message: | |
| 36 | + This issue has been automatically marked as stale due to inactivity. |
| 37 | + It will be closed in 30 days if no further activity occurs. |
| 38 | + If you believe this issue is still relevant, please add a comment to keep it open. |
| 39 | +
|
| 40 | + close-issue-message: | |
| 41 | + This issue has been automatically closed due to inactivity. |
| 42 | + If you believe this issue is still relevant, please reopen it or create a new issue with updated information. |
| 43 | +
|
| 44 | + # Exclude needs-information issues from this step |
| 45 | + exempt-issue-labels: 'no-stale,needs-information' |
| 46 | + |
| 47 | + # Remove stale label when issue/PR becomes active again |
| 48 | + remove-stale-when-updated: true |
| 49 | + |
| 50 | + # Apply to pull requests with same timeline |
| 51 | + days-before-pr-stale: ${{ env.DAYS_BEFORE_STALE }} |
| 52 | + days-before-pr-close: ${{ env.DAYS_BEFORE_CLOSE }} |
| 53 | + |
| 54 | + stale-pr-message: | |
| 55 | + This pull request has been automatically marked as stale due to inactivity. |
| 56 | + It will be closed in 30 days if no further activity occurs. |
| 57 | +
|
| 58 | + close-pr-message: | |
| 59 | + This pull request has been automatically closed due to inactivity. |
| 60 | + If you would like to continue this work, please reopen the PR or create a new one. |
| 61 | +
|
| 62 | + # Only exclude no-stale PRs (needs-information PRs follow standard timeline) |
| 63 | + exempt-pr-labels: 'no-stale' |
| 64 | + |
| 65 | + # Second step: Handle needs-information issues with accelerated timeline |
| 66 | + - name: Mark needs-information issues as stale |
| 67 | + uses: actions/stale@v9 |
| 68 | + with: |
| 69 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + |
| 71 | + # Accelerated timeline for needs-information |
| 72 | + days-before-stale: ${{ env.NEEDS_INFO_DAYS_BEFORE_STALE }} |
| 73 | + days-before-close: ${{ env.NEEDS_INFO_DAYS_BEFORE_CLOSE }} |
| 74 | + |
| 75 | + # Explicit stale label configuration |
| 76 | + stale-issue-label: "stale" |
| 77 | + |
| 78 | + # Only target ISSUES with needs-information label (not PRs) |
| 79 | + only-issue-labels: 'needs-information' |
| 80 | + |
| 81 | + stale-issue-message: | |
| 82 | + This issue has been marked as stale because it requires additional information |
| 83 | + that has not been provided for 30 days. It will be closed in 7 days if the |
| 84 | + requested information is not provided. |
| 85 | +
|
| 86 | + close-issue-message: | |
| 87 | + This issue has been closed because the requested information was not provided within the specified timeframe. |
| 88 | + If you can provide the missing information, please reopen this issue or create a new one. |
| 89 | +
|
| 90 | + # Disable PR processing for this step |
| 91 | + days-before-pr-stale: -1 |
| 92 | + days-before-pr-close: -1 |
| 93 | + |
| 94 | + # Remove stale label when issue becomes active again |
| 95 | + remove-stale-when-updated: true |
0 commit comments