Blame Raw
Cohee · b06a6295 · · 133 lines (5.3 KB)
1 contributor
1name: 🕒 Close Stale Issues/PRs Workflow
2
3on:
4 # Run the workflow every day
5 workflow_dispatch:
6 schedule:
7 - cron: '0 0 * * *' # Runs every day at midnight UTC
8
9permissions:
10 contents: read
11 issues: write
12 pull-requests: write
13
14jobs:
15 mark-inactivity:
16 name: ⏳ Mark Issues/PRs without Activity
17 runs-on: ubuntu-latest
18 if: always()
19
20 steps:
21 - name: Mint App Token
22 id: app
23 # Create a GitHub App token
24 # https://github.com/marketplace/actions/create-github-app-token
25 uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2
26 with:
27 app-id: ${{ vars.ST_BOT_APP_ID }}
28 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
29 owner: ${{ github.repository_owner }}
30
31 - name: Mark Issues/PRs without Activity
32 # Close Stale Issues and PRs
33 # https://github.com/marketplace/actions/close-stale-issues
34 uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
35 with:
36 repo-token: ${{ steps.app.outputs.token }}
37 days-before-stale: 183
38 days-before-close: 7
39 operations-per-run: 30
40 remove-stale-when-updated: true
41 enable-statistics: true
42 stale-issue-message: >
43 ⏳ This issue has been inactive for 6 months. If it's still relevant, drop a comment below to keep it open.
44 Otherwise, it will be auto-closed in 7 days.
45 stale-pr-message: >
46 ⏳ This PR has been inactive for 6 months. If it's still relevant, update it or remove the stale label.
47 Otherwise, it will be auto-closed in 7 days.
48 close-issue-message: >
49 🔒 This issue was auto-closed due to inactivity for over 6 months.
50 close-pr-message: >
51 🔒 This PR was auto-closed due to inactivity for over 6 months.
52 stale-issue-label: '⚰️ Stale'
53 close-issue-label: '🕸️ Inactive'
54 stale-pr-label: '⚰️ Stale'
55 close-pr-label: '🕸️ Inactive'
56 exempt-issue-labels: '📌 Keep Open'
57 exempt-pr-labels: '📌 Keep Open'
58
59 await-user-response:
60 name: ⚠️ Mark Issues/PRs Awaiting User Response
61 needs: [mark-inactivity]
62 runs-on: ubuntu-latest
63 if: always()
64
65 steps:
66 - name: Mint App Token
67 id: app
68 # Create a GitHub App token
69 # https://github.com/marketplace/actions/create-github-app-token
70 uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2
71 with:
72 app-id: ${{ vars.ST_BOT_APP_ID }}
73 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
74 owner: ${{ github.repository_owner }}
75
76 - name: Mark Issues/PRs Awaiting User Response
77 # Close Stale Issues and PRs
78 # https://github.com/marketplace/actions/close-stale-issues
79 uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
80 with:
81 repo-token: ${{ steps.app.outputs.token }}
82 days-before-stale: 7
83 days-before-close: 7
84 operations-per-run: 30
85 remove-stale-when-updated: true
86 stale-issue-message: >
87 ⚠️ Hey! We need some more info to move forward with this issue.
88 Please provide the requested details in the next few days to keep this ticket open.
89 close-issue-message: >
90 🔒 This issue was auto-closed due to no response from user.
91 only-labels: '🚏 Awaiting User Response'
92 labels-to-remove-when-unstale: '🚏 Awaiting User Response'
93 stale-issue-label: '🛑 No Response'
94 close-issue-label: '🕸️ Inactive'
95 exempt-issue-labels: '🚧 Alternative Exists'
96
97 alternative-exists:
98 name: 🔄 Mark Issues with Alternative Exists
99 needs: [mark-inactivity, await-user-response]
100 runs-on: ubuntu-latest
101 if: always()
102
103 steps:
104 - name: Mint App Token
105 id: app
106 # Create a GitHub App token
107 # https://github.com/marketplace/actions/create-github-app-token
108 uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2
109 with:
110 app-id: ${{ vars.ST_BOT_APP_ID }}
111 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
112 owner: ${{ github.repository_owner }}
113
114 - name: Mark Issues with Alternative Exists
115 # Close Stale Issues and PRs
116 # https://github.com/marketplace/actions/close-stale-issues
117 uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
118 with:
119 repo-token: ${{ steps.app.outputs.token }}
120 days-before-stale: 7
121 days-before-close: 7
122 operations-per-run: 30
123 remove-stale-when-updated: true
124 stale-issue-message: >
125 🔄 An alternative solution has been provided for this issue.
126 Did this solve your problem? If so, we'll go ahead and close it.
127 If you still need help, drop a comment within the next 7 days to keep this open.
128 close-issue-message: >
129 ✅ Closing this issue due to no confirmation on the alternative solution.
130 only-labels: '🚧 Alternative Exists'
131 stale-issue-label: '🚏 Awaiting User Response'
132 close-issue-label: '🕸️ Inactive'
133 exempt-issue-labels: '📌 Keep Open'