diff --git a/README.md b/README.md index 7176a0f..82a23cf 100644 --- a/README.md +++ b/README.md @@ -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 `''` @@ -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 `''` @@ -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 `''` @@ -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' @@ -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' @@ -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 diff --git a/action.yml b/action.yml index 881d669..85db87c 100644 --- a/action.yml +++ b/action.yml @@ -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: '' @@ -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: '' @@ -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: '' diff --git a/src/index.js b/src/index.js index a8f3055..5fc0dcd 100644 --- a/src/index.js +++ b/src/index.js @@ -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`]; diff --git a/src/schema.js b/src/schema.js index 392dc3f..edd09a5 100644 --- a/src/schema.js +++ b/src/schema.js @@ -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() @@ -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() @@ -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()