1
- name : Stale handler
2
-
1
+ name : ' Stale handler'
3
2
on :
4
- push : # when push this files to branches....
5
- branches :
6
- - ' main'
7
- - ' gh-actions/test'
8
- paths :
9
- - ' .github/workflows/stale.yml' # - this workflow
10
- workflow_dispatch : # manually
3
+ schedule :
4
+ - cron : ' 0 0 * * *' # Run every day at midnight
5
+ workflow_dispatch :
11
6
inputs :
12
7
debug-only :
13
8
type : boolean
14
- description : ' If enabled, debug mode is on and then API calls that can alter your issues will not happen '
9
+ description : " Does a dry-run when enabled. No PR's will be altered "
15
10
required : true
16
11
default : true
17
- schedule : # or
18
- - cron : " 0 0 * * *" # once a day at 00:00 o'clock
19
12
20
13
permissions :
21
- # no checkout/branching needed
22
- contents : none
23
-
24
- # This allows a subsequently queued workflow run to interrupt/wait for previous runs
25
- concurrency :
26
- group : ' ${{ github.workflow }}'
27
- cancel-in-progress : false # true: interrupt, false = wait for
14
+ pull-requests : write
28
15
29
16
jobs :
30
17
stale :
31
- name : Staler job
32
18
runs-on : ubuntu-latest
33
- outputs :
34
- # "XXX-len": the length of the "XXX" output object
35
- staled-issues : ${{ steps.set-staled.outputs.issues }}
36
- staled-issues-len : ${{ steps.set-staled.outputs.issues-len }}
37
- staled-prs : ${{ steps.set-staled.outputs.prs }}
38
- staled-prs-len : ${{ steps.set-staled.outputs.prs-len }}
39
- closed-issues : ${{ steps.set-closed.outputs.issues }}
40
- closed-issues-len : ${{ steps.set-closed.outputs.issues-len }}
41
- closed-prs : ${{ steps.set-closed.outputs.prs }}
42
- closed-prs-len : ${{ steps.set-closed.outputs.prs-len }}
43
- # enable write access rights to allow bot comments and labeling
44
- permissions :
45
- issues : write
46
- pull-requests : write
47
19
steps :
48
- - name : Stale issues
49
- uses : actions/stale@v9
50
- id : stale-issues
20
+ - uses : actions/stale@v9
51
21
with :
52
- debug-only : ${{ github.event.inputs.debug-only == 'true' }}
53
- operations-per-run : 30
54
- days-before-stale : 60
55
- days-before-close : 30
56
- ignore-updates : false
57
- remove-stale-when-updated : true
58
- stale-issue-label : " stale"
59
- close-issue-label : " stale: closed"
60
- stale-issue-message : |
61
- This issue has been automatically marked as stale because it has not had recent activity during last 60 days :sleeping:
62
-
63
- It will be closed in 30 days if no further activity occurs. To unstale this issue, remove stale label or add a comment with a detailed explanation.
64
-
65
- There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest.
66
-
67
- Thank you for your patience :heart:
68
- close-issue-message : |
69
- This issue has been automatically closed because it has been inactive during the last 30 days since being marked as stale.
70
-
71
- As author or maintainer, it can always be reopened if you see that carry on been useful.
72
-
73
- Anyway, thank you for your interest in contribute :heart:
74
- close-issue-reason : not_planned
75
- exempt-issue-labels : " blocked,must,should,keep,:busts_in_silhouette: discussion,:eyes: Needs Review,:pushpin: pinned"
76
- # disable PR processing at all (this step is for treat issues)
77
- days-before-pr-stale : -1
78
- days-before-pr-close : -1
79
- ignore-pr-updates : true
80
- remove-pr-stale-when-updated : false
81
- stale-pr-label : " "
82
-
83
- - name : Print outputs for issues
84
- run : echo ${{ format('{0},{1}', toJSON(steps.stale-issues.outputs.staled-issues-prs), toJSON(steps.stale-issues.outputs.closed-issues-prs)) }}
85
-
86
- - name : Stale Pull Requests
87
- uses : actions/stale@v9
88
- id : stale-prs
89
- with :
90
- debug-only : ${{ github.event.inputs.debug-only == 'true' }}
91
- operations-per-run : 30
92
- days-before-stale : 60
93
- days-before-close : 30
94
- ignore-updates : false
95
- remove-stale-when-updated : true
96
- stale-pr-label : " stale"
97
- close-pr-label : " stale: closed"
22
+ days-before-issue-stale : -1 # Don't mark issues as stale
23
+ days-before-issue-close : -1 # Don't close issues
98
24
stale-pr-message : |
99
- This Pull Request has been automatically marked as stale because it has not had recent activity during last 60 days :sleeping:
25
+ ' This Pull Request has been automatically marked as stale because it has not had recent activity during last 60 days :sleeping:
100
26
101
27
It will be closed in 30 days if no further activity occurs. To unstale this PR, draft it, remove stale label, comment with a detailed explanation or push more commits.
102
28
103
29
There can be many reasons why some specific PR has no activity. The most probable cause is lack of time, not lack of interest.
104
30
105
- Thank you for your patience :heart:
31
+ Thank you for your patience :heart:'
106
32
close-pr-message : |
107
33
This Pull Request has been automatically closed because it has been inactive during the last 30 days since being marked as stale.
108
34
109
35
As author or maintainer, it can always be reopened if you see that carry on been useful.
110
36
111
37
Anyway, thank you for your interest in contribute :heart:
38
+ days-before-pr-stale : 60
39
+ days-before-pr-close : 30
40
+ stale-pr-label : ' stale'
41
+ exempt-pr-labels : ' keep' # Don't mark PR's with this label as stale
42
+ labels-to-remove-when-unstale : ' stale'
112
43
exempt-draft-pr : true
113
- exempt-pr-labels : " blocked,must,should,keep,:busts_in_silhouette: discussion,:eyes: Needs Review"
114
- delete-branch : false # if true, job needs permissions "contents: write"
115
- # disable issues processing at all (this step is for treat PRs)
116
- days-before-issue-stale : -1
117
- days-before-issue-close : -1
118
- ignore-issue-updates : true
119
- remove-issue-stale-when-updated : false
120
- stale-issue-label : " "
121
-
122
- - name : Print outputs for PRs
123
- run : echo ${{ format('{0},{1}', toJSON(steps.stale-prs.outputs.staled-issues-prs), toJSON(steps.stale-prs.outputs.closed-issues-prs)) }}
124
-
125
- # # Removing private properties from each JSON object and compute array length
126
- # # TODO: Delete these set-* workarounds when resolve actions/stale#806 ?
127
- - name : Set staled
128
- id : set-staled
129
- run : |
130
- echo $INPUT_ISSUES \
131
- | jq --compact-output --raw-output 'del(.[] | .[to_entries[] | .key | select(startswith("_"))])' \
132
- | sed -e 's/^/issues=/' \
133
- >> $GITHUB_OUTPUT
134
- echo $INPUT_ISSUES \
135
- | jq --raw-output '. | length' \
136
- | sed -e 's/^/issues-len=/' \
137
- >> $GITHUB_OUTPUT
138
-
139
- echo $INPUT_PRS \
140
- | jq --compact-output --raw-output 'del(.[] | .[to_entries[] | .key | select(startswith("_"))])' \
141
- | sed -e 's/^/prs=/' \
142
- >> $GITHUB_OUTPUT
143
- echo $INPUT_PRS \
144
- | jq --raw-output '. | length' \
145
- | sed -e 's/^/prs-len=/' \
146
- >> $GITHUB_OUTPUT
147
- env :
148
- INPUT_ISSUES : ${{ steps.stale-issues.outputs.staled-issues-prs }}
149
- INPUT_PRS : ${{ steps.stale-prs.outputs.staled-issues-prs }}
150
- - name : Set closed
151
- id : set-closed
152
- run : |
153
- echo $INPUT_ISSUES \
154
- | jq --compact-output --raw-output 'del(.[] | .[to_entries[] | .key | select(startswith("_"))])' \
155
- | sed -e 's/^/issues=/' \
156
- >> $GITHUB_OUTPUT
157
- echo $INPUT_ISSUES \
158
- | jq --raw-output '. | length' \
159
- | sed -e 's/^/issues-len=/' \
160
- >> $GITHUB_OUTPUT
161
-
162
- echo $INPUT_PRS \
163
- | jq --compact-output --raw-output 'del(.[] | .[to_entries[] | .key | select(startswith("_"))])' \
164
- | sed -e 's/^/prs=/' \
165
- >> $GITHUB_OUTPUT
166
- echo $INPUT_PRS \
167
- | jq --raw-output '. | length' \
168
- | sed -e 's/^/prs-len=/' \
169
- >> $GITHUB_OUTPUT
170
- env :
171
- INPUT_ISSUES : ${{ steps.stale-issues.outputs.closed-issues-prs }}
172
- INPUT_PRS : ${{ steps.stale-prs.outputs.closed-issues-prs }}
173
-
174
- - name : Write job summary
175
- run : |
176
- echo "### Staled issues" \
177
- >> $GITHUB_STEP_SUMMARY
178
- # render json array to a Markdown table with an optional "No records" message if empty
179
- echo "$STALED_ISSUES" \
180
- | jq --raw-output 'map("| [#\(.number)](\(env.GITHUB_ISSUES_URL)/\(.number)) | \(.title) |") | join("\n") | if (. == "") then "\nNo records.\n" else "\n| | Title |\n|---:|:------|\n\(.)\n" end' \
181
- >> $GITHUB_STEP_SUMMARY
182
-
183
- echo "### Staled pull requests" \
184
- >> $GITHUB_STEP_SUMMARY
185
- # render json array to a Markdown table with an optional "No records" message if empty
186
- echo "$STALED_PRS" \
187
- | jq --raw-output 'map("| [#\(.number)](\(env.GITHUB_PULL_URL)/\(.number)) | \(.title) |") | join("\n") | if (. == "") then "\nNo records.\n" else "\n| | Title |\n|---:|:------|\n\(.)\n" end' \
188
- >> $GITHUB_STEP_SUMMARY
189
-
190
- echo "### Closed issues" \
191
- >> $GITHUB_STEP_SUMMARY
192
- # render json array to a Markdown table with an optional "No records" message if empty
193
- echo "$CLOSED_ISSUES" \
194
- | jq --raw-output 'map("| [#\(.number)](\(env.GITHUB_ISSUES_URL)/\(.number)) | \(.title) |") | join("\n") | if (. == "") then "\nNo records.\n" else "\n| | Title |\n|---:|:------|\n\(.)\n" end' \
195
- >> $GITHUB_STEP_SUMMARY
196
-
197
- echo "### Closed pull requests" \
198
- >> $GITHUB_STEP_SUMMARY
199
- # render json array to a Markdown table with an optional "No records" message if empty
200
- echo "$CLOSED_PRS" \
201
- | jq --raw-output 'map("| [#\(.number)](\(env.GITHUB_PULL_URL)/\(.number)) | \(.title) |") | join("\n") | if (. == "") then "\nNo records.\n" else "\n| | Title |\n|---:|:------|\n\(.)\n" end' \
202
- >> $GITHUB_STEP_SUMMARY
203
- env :
204
- GITHUB_ISSUES_URL : ${{ format('{0}/{1}/issues', github.server_url, github.repository) }}
205
- GITHUB_PULL_URL : ${{ format('{0}/{1}/pull', github.server_url, github.repository) }}
206
- STALED_ISSUES : ${{ steps.set-staled.outputs.issues }}
207
- CLOSED_ISSUES : ${{ steps.set-closed.outputs.issues }}
208
- STALED_PRS : ${{ steps.set-staled.outputs.prs }}
209
- CLOSED_PRS : ${{ steps.set-closed.outputs.prs }}
44
+ debug-only : ${{ github.event.inputs.debug-only == 'true' }}
45
+ enable-statistics : true
0 commit comments