Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to lock open threads #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ The action can be configured using [input parameters](https://docs.github.com/en
- Labels to remove before locking an issue, value must be
a comma separated list of labels or `''`
- Optional, defaults to `''`
- **`include-issue-currently-open`**
- Open issues are also eligible to be locked.
- Optional, defaults to `false`
- **`issue-comment`**
- Comment to post before locking an issue
- Optional, defaults to `''`
Expand Down Expand Up @@ -139,6 +142,9 @@ The action can be configured using [input parameters](https://docs.github.com/en
- Labels to remove before locking a pull request, value must be
a comma separated list of labels or `''`
- Optional, defaults to `''`
- **`include-pr-currently-open`**
- Open pull requests are also eligible to be locked.
- Optional, defaults to `false`
- **`pr-comment`**
- Comment to post before locking a pull request
- Optional, defaults to `''`
Expand Down Expand Up @@ -198,6 +204,11 @@ The action can be configured using [input parameters](https://docs.github.com/en
- Labels to remove before locking a discussion, value must be
a comma separated list of labels or `''`
- Optional, defaults to `''`
- **`include-discussion-currently-open`**
- Open discussions are also eligible to be locked. Useful
for projects that do not use the open/close state on
discussions.
- Optional, defaults to `false`
- **`discussion-comment`**
- Comment to post before locking a discussion
- Optional, defaults to `''`
Expand Down Expand Up @@ -308,6 +319,7 @@ jobs:
exclude-any-issue-labels: ''
add-issue-labels: ''
remove-issue-labels: ''
include-issue-currently-open: false
issue-comment: ''
issue-lock-reason: 'resolved'
pr-inactive-days: '365'
Expand All @@ -322,6 +334,7 @@ jobs:
exclude-any-pr-labels: ''
add-pr-labels: ''
remove-pr-labels: ''
include-pr-currently-open: false
pr-comment: ''
pr-lock-reason: 'resolved'
discussion-inactive-days: '365'
Expand All @@ -336,6 +349,7 @@ jobs:
exclude-any-discussion-labels: ''
add-discussion-labels: ''
remove-discussion-labels: ''
include-discussion-currently-open: false
discussion-comment: ''
process-only: ''
log-output: false
Expand Down
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ inputs:
remove-issue-labels:
description: 'Labels to remove before locking an issue, value must be a comma separated list of labels'
default: ''
include-issue-currently-open:
description: 'Open issues are also eligible to be locked'
default: false
issue-comment:
description: 'Comment to post before locking an issue'
default: ''
Expand Down Expand Up @@ -83,6 +86,9 @@ inputs:
remove-pr-labels:
description: 'Labels to remove before locking a pull request, value must be a comma separated list of labels'
default: ''
include-pr-currently-open:
description: 'Open pull requests are also eligible to be locked'
default: false
pr-comment:
description: 'Comment to post before locking a pull request'
default: ''
Expand Down Expand Up @@ -125,6 +131,9 @@ inputs:
remove-discussion-labels:
description: 'Labels to remove before locking a discussion, value must be a comma separated list of labels'
default: ''
include-discussion-currently-open:
description: 'Open discussions are also eligible to be locked'
default: false
discussion-comment:
description: 'Comment to post before locking a discussion'
default: ''
Expand Down
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,12 @@ class App {
const updatedTime = this.getUpdatedTimestamp(
this.config[`${threadType}-inactive-days`]
);
let query = `repo:${owner}/${repo} updated:<${updatedTime} is:closed is:unlocked`;
let query = `repo:${owner}/${repo} updated:<${updatedTime} is:unlocked`;

const includeOpen = this.config[`include-${threadType}-currently-open`];
if (!includeOpen) {
query += ' is:closed';
}

const includeAnyLabels = this.config[`include-any-${threadType}-labels`];
const includeAllLabels = this.config[`include-all-${threadType}-labels`];
Expand Down
6 changes: 6 additions & 0 deletions src/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ const schema = Joi.object({

'remove-issue-labels': joiLabels.default(''),

'include-issue-currently-open': Joi.boolean().default(false),

'issue-comment': Joi.string().trim().max(10000).allow('').default(''),

'issue-lock-reason': Joi.string()
Expand Down Expand Up @@ -173,6 +175,8 @@ const schema = Joi.object({

'remove-pr-labels': joiLabels.default(''),

'include-pr-currently-open': Joi.boolean().default(false),

'pr-comment': Joi.string().trim().max(10000).allow('').default(''),

'pr-lock-reason': Joi.string()
Expand Down Expand Up @@ -207,6 +211,8 @@ const schema = Joi.object({

'remove-discussion-labels': joiLabels.default(''),

'include-discussion-currently-open': Joi.boolean().default(false),

'discussion-comment': Joi.string().trim().max(10000).allow('').default(''),

'process-only': Joi.alternatives()
Expand Down