You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BREAKING CHANGE: Discussions are also processed by default,
set the `process-only` input parameter to preserve the old behavior
```yaml
steps:
- uses: dessant/lock-threads@v5
with:
process-only: 'issues, prs'
```
Closes#25.
@@ -16,13 +16,13 @@ please consider contributing with
16
16
17
17
## Usage
18
18
19
-
Create the `lock.yml` workflow file in the `.github/workflows` directory,
20
-
use one of the [example workflows](#examples) to get started.
19
+
Create the `lock-threads.yml` workflow file in the `.github/workflows`
20
+
directory, use one of the [example workflows](#examples) to get started.
21
21
22
22
### Inputs
23
23
24
24
<!-- prettier-ignore -->
25
-
The action can be configured using [input parameters](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepswith).
25
+
The action can be configured using [input parameters](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswith).
26
26
27
27
-**`github-token`**
28
28
- GitHub access token, value must be `${{ github.token }}` or an encrypted
@@ -146,9 +146,65 @@ The action can be configured using [input parameters](https://docs.github.com/en
146
146
- Reason for locking a pull request, value must be one
147
147
of `resolved`, `off-topic`, `too heated`, `spam` or `''`
148
148
- Optional, defaults to `resolved`
149
+
-**`discussion-inactive-days`**
150
+
- Number of days of inactivity before a closed discussion is locked
151
+
- Optional, defaults to `365`
152
+
-**`exclude-discussion-created-before`**
153
+
- Do not lock discussions created before a given date,
154
+
value must follow ISO 8601, ignored
155
+
when `exclude-discussion-created-between` is set
156
+
- Optional, defaults to `''`
157
+
-**`exclude-discussion-created-after`**
158
+
- Do not lock discussions created after a given date,
159
+
value must follow ISO 8601, ignored
160
+
when `exclude-discussion-created-between` is set
161
+
- Optional, defaults to `''`
162
+
-**`exclude-discussion-created-between`**
163
+
- Do not lock discussions created in a given time interval,
164
+
value must follow ISO 8601
165
+
- Optional, defaults to `''`
166
+
-**`exclude-discussion-closed-before`**
167
+
- Do not lock discussions closed before a given date,
168
+
value must follow ISO 8601, ignored
169
+
when `exclude-discussion-closed-between` is set
170
+
- Optional, defaults to `''`
171
+
-**`exclude-discussion-closed-after`**
172
+
- Do not lock discussions closed after a given date,
173
+
value must follow ISO 8601, ignored
174
+
when `exclude-discussion-closed-between` is set
175
+
- Optional, defaults to `''`
176
+
-**`exclude-discussion-closed-between`**
177
+
- Do not lock discussions closed in a given time interval,
178
+
value must follow ISO 8601
179
+
- Optional, defaults to `''`
180
+
-**`include-any-discussion-labels`**
181
+
- Only lock discussions with any of these labels, value must be
182
+
a comma separated list of labels or `''`, ignored
183
+
when `include-all-discussion-labels` is set
184
+
- Optional, defaults to `''`
185
+
-**`include-all-discussion-labels`**
186
+
- Only lock discussions with all these labels, value must be
187
+
a comma separated list of labels or `''`
188
+
- Optional, defaults to `''`
189
+
-**`exclude-any-discussion-labels`**
190
+
- Do not lock discussions with any of these labels, value must be
191
+
a comma separated list of labels or `''`
192
+
- Optional, defaults to `''`
193
+
-**`add-discussion-labels`**
194
+
- Labels to add before locking a discussion, value must be
195
+
a comma separated list of labels or `''`
196
+
- Optional, defaults to `''`
197
+
-**`remove-discussion-labels`**
198
+
- Labels to remove before locking a discussion, value must be
199
+
a comma separated list of labels or `''`
200
+
- Optional, defaults to `''`
201
+
-**`discussion-comment`**
202
+
- Comment to post before locking a discussion
203
+
- Optional, defaults to `''`
149
204
-**`process-only`**
150
-
- Limit locking to only issues or pull requests, value must be
151
-
one of `issues`, `prs` or `''`
205
+
- Only lock issues, pull requests or discussions,
206
+
value must be a comma separated list, list items must be
207
+
one of `issues`, `prs` or `discussions`
152
208
- Optional, defaults to `''`
153
209
-**`log-output`**
154
210
- Log output parameters, value must be either `true` or `false`
@@ -165,11 +221,15 @@ The action can be configured using [input parameters](https://docs.github.com/en
165
221
- Pull requests that have been locked, value is a JSON string in the form
166
222
of `[{"owner": "actions", "repo": "toolkit", "issue_number": 1}]`
167
223
- Defaults to `''`
224
+
-**`discussions`**
225
+
- Discussions that have been locked, value is a JSON string in the form
226
+
of `[{"owner": "actions", "repo": "toolkit", "discussion_number": 1}]`
227
+
- Defaults to `''`
168
228
169
229
## Examples
170
230
171
-
The following workflow will search once an hour for closed issues
172
-
and pull requests that have not had any activity
231
+
The following workflow will search once an hour for closed issues,
232
+
pull requests and discussions that have not had any activity
173
233
in the past year and can be locked.
174
234
175
235
<!-- prettier-ignore -->
@@ -184,19 +244,20 @@ on:
184
244
permissions:
185
245
issues: write
186
246
pull-requests: write
247
+
discussions: write
187
248
188
249
concurrency:
189
-
group: lock
250
+
group: lock-threads
190
251
191
252
jobs:
192
253
action:
193
254
runs-on: ubuntu-latest
194
255
steps:
195
-
- uses: dessant/lock-threads@v4
256
+
- uses: dessant/lock-threads@v5
196
257
```
197
258
198
-
Edit the workflow after the initial backlog of issues and pull requests
199
-
has been processed to reduce the frequency of scheduled runs.
259
+
Edit the workflow after the initial backlog of issues, pull requests
260
+
and discussions has been processed to reduce the frequency of scheduled runs.
200
261
Running the workflow only once a day helps reduce resource usage.
201
262
202
263
<!-- prettier-ignore -->
@@ -223,15 +284,16 @@ on:
223
284
permissions:
224
285
issues: write
225
286
pull-requests: write
287
+
discussions: write
226
288
227
289
concurrency:
228
-
group: lock
290
+
group: lock-threads
229
291
230
292
jobs:
231
293
action:
232
294
runs-on: ubuntu-latest
233
295
steps:
234
-
- uses: dessant/lock-threads@v4
296
+
- uses: dessant/lock-threads@v5
235
297
with:
236
298
github-token: ${{ github.token }}
237
299
issue-inactive-days: '365'
@@ -262,19 +324,32 @@ jobs:
262
324
remove-pr-labels: ''
263
325
pr-comment: ''
264
326
pr-lock-reason: 'resolved'
327
+
discussion-inactive-days: '365'
328
+
exclude-discussion-created-before: ''
329
+
exclude-discussion-created-after: ''
330
+
exclude-discussion-created-between: ''
331
+
exclude-discussion-closed-before: ''
332
+
exclude-discussion-closed-after: ''
333
+
exclude-discussion-closed-between: ''
334
+
include-any-discussion-labels: ''
335
+
include-all-discussion-labels: ''
336
+
exclude-any-discussion-labels: ''
337
+
add-discussion-labels: ''
338
+
remove-discussion-labels: ''
339
+
discussion-comment: ''
265
340
process-only: ''
266
341
log-output: false
267
342
```
268
343
269
-
### Filtering issues and pull requests
344
+
### Filtering issues, pull requests and discussions
270
345
271
346
This step will lock only issues, and exclude issues created before 2018,
272
347
or those with the `upstream` or `help-wanted` labels applied.
This step will lock issues that have not had any activity in the past 180 days.
399
+
This step will lock discussions that have not had any activity
400
+
in the past 180 days.
324
401
325
402
<!-- prettier-ignore -->
326
403
```yaml
327
404
steps:
328
-
- uses: dessant/lock-threads@v4
405
+
- uses: dessant/lock-threads@v5
329
406
with:
330
-
issue-inactive-days: '180'
331
-
process-only: 'issues'
407
+
discussion-inactive-days: '180'
408
+
process-only: 'discussions'
332
409
333
410
```
334
411
@@ -340,7 +417,7 @@ and apply the `outdated` label to issues.
340
417
<!-- prettier-ignore -->
341
418
```yaml
342
419
steps:
343
-
- uses: dessant/lock-threads@v4
420
+
- uses: dessant/lock-threads@v5
344
421
with:
345
422
add-issue-labels: 'outdated'
346
423
issue-comment: >
@@ -351,6 +428,7 @@ and apply the `outdated` label to issues.
351
428
This pull request has been automatically locked since there
352
429
has not been any recent activity after it was closed.
353
430
Please open a new issue for related bugs.
431
+
process-only: 'issues, prs'
354
432
```
355
433
356
434
This step will apply the `qa: done` and `archived` labels,
@@ -360,10 +438,11 @@ before locking issues.
360
438
<!-- prettier-ignore -->
361
439
```yaml
362
440
steps:
363
-
- uses: dessant/lock-threads@v4
441
+
- uses: dessant/lock-threads@v5
364
442
with:
365
443
add-issue-labels: 'qa: done, archived'
366
444
remove-issue-labels: 'qa: primary, needs: user feedback'
445
+
process-only: 'issues'
367
446
```
368
447
369
448
### Using a personal access token
@@ -372,39 +451,38 @@ The action uses an installation access token by default to interact with GitHub.
372
451
You may also authenticate with a personal access token to perform actions
373
452
as a GitHub user instead of the `github-actions` app.
374
453
375
-
Create a [personal access token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token)
454
+
Create a [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic)
376
455
with the `repo` or `public_repo` scopes enabled, and add the token as an
## How are issues and pull requests determined to be inactive?
468
+
## How are issues, pull requests and discussions determined to be inactive?
390
469
391
-
The action uses GitHub's [updated](https://help.github.com/en/github/searching-for-information-on-github/searching-issues-and-pull-requests#search-by-when-an-issue-or-pull-request-was-created-or-last-updated)
392
-
search qualifier to determine inactivity. Any change to an issue or pull request
393
-
is considered an update, including comments, changing labels,
394
-
applying or removing milestones, or pushing commits.
470
+
The action uses GitHub's [updated](https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests#search-by-when-an-issue-or-pull-request-was-created-or-last-updated)
471
+
search qualifier to determine inactivity. Any change to an issue, pull request
472
+
or discussion is considered an update, including new comments,
473
+
or changing labels.
395
474
396
-
An easy way to check and see which issues or pull requests will initially
397
-
be locked is to add the `updated` search qualifier to either the issue
398
-
or pull request search field for your repository:
475
+
An easy way to see which threads will initially be locked is to add
476
+
the `updated` search qualifier to the issue, pull request or discussion
477
+
search field for your repository, adjust the date based on the value
478
+
of the `*-inactive-days` input parameter:
399
479
`is:closed is:unlocked updated:<2018-12-20`.
400
-
Adjust the date to be 365 days ago (or whatever you set for `*-inactive-days`)
401
-
to see which issues or pull requests will be locked.
402
480
403
-
## Why are only some issues and pull requests processed?
481
+
## Why are only some issues, pull requests and discussions processed?
404
482
405
-
To avoid triggering abuse prevention mechanisms on GitHub, only 50 issues
406
-
and pull requests will be handled at once. If your repository has more
407
-
than that, it will just take a few hours or days to process them all.
483
+
To avoid triggering abuse prevention mechanisms on GitHub, only 50 threads
484
+
will be handled at a time. If your repository has more than that,
485
+
it will take a few hours or days to process them all.
Copy file name to clipboardExpand all lines: action.yml
+43-2Lines changed: 43 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
name: 'Lock Threads'
2
-
description: 'Lock closed issues and pull requests after a period of inactivity'
2
+
description: 'Lock closed issues, pull requests and discussions after a period of inactivity'
3
3
author: 'Armin Sebastian'
4
4
inputs:
5
5
github-token:
@@ -89,8 +89,47 @@ inputs:
89
89
pr-lock-reason:
90
90
description: 'Reason for locking a pull request, value must be one of `resolved`, `off-topic`, `too heated` or `spam`'
91
91
default: 'resolved'
92
+
discussion-inactive-days:
93
+
description: 'Number of days of inactivity before a closed discussion is locked'
94
+
default: '365'
95
+
exclude-discussion-created-before:
96
+
description: 'Do not lock discussions created before a given date, value must follow ISO 8601'
97
+
default: ''
98
+
exclude-discussion-created-after:
99
+
description: 'Do not lock discussions created after a given date, value must follow ISO 8601'
100
+
default: ''
101
+
exclude-discussion-created-between:
102
+
description: 'Do not lock discussions created in a given time interval, value must follow ISO 8601'
103
+
default: ''
104
+
exclude-discussion-closed-before:
105
+
description: 'Do not lock discussions closed before a given date, value must follow ISO 8601'
106
+
default: ''
107
+
exclude-discussion-closed-after:
108
+
description: 'Do not lock discussions closed after a given date, value must follow ISO 8601'
109
+
default: ''
110
+
exclude-discussion-closed-between:
111
+
description: 'Do not lock discussions closed in a given time interval, value must follow ISO 8601'
112
+
default: ''
113
+
include-any-discussion-labels:
114
+
description: 'Only lock issues with any of these labels, value must be a comma separated list of labels'
115
+
default: ''
116
+
include-all-discussion-labels:
117
+
description: 'Only lock discussions with all these labels, value must be a comma separated list of labels'
118
+
default: ''
119
+
exclude-any-discussion-labels:
120
+
description: 'Do not lock discussions with any of these labels, value must be a comma separated list of labels'
121
+
default: ''
122
+
add-discussion-labels:
123
+
description: 'Labels to add before locking a discussion, value must be a comma separated list of labels'
124
+
default: ''
125
+
remove-discussion-labels:
126
+
description: 'Labels to remove before locking a discussion, value must be a comma separated list of labels'
127
+
default: ''
128
+
discussion-comment:
129
+
description: 'Comment to post before locking a discussion'
130
+
default: ''
92
131
process-only:
93
-
description: 'Limit locking to only issues or pull requests, value must be one of `issues`or `prs`'
132
+
description: 'Only lock issues, pull requests or discussions, value must be a comma separated list, list items must be one of `issues`, `prs` or `discussions`'
94
133
default: ''
95
134
log-output:
96
135
description: 'Log output parameters, value must be either `true` or `false`'
@@ -100,6 +139,8 @@ outputs:
100
139
description: 'Issues that have been locked, value is a JSON string'
101
140
prs:
102
141
description: 'Pull requests that have been locked, value is a JSON string'
142
+
discussions:
143
+
description: 'Discussions that have been locked, value is a JSON string'
0 commit comments