mirror of
https://github.com/actions/stale.git
synced 2025-12-12 13:07:28 +00:00
Add close-issue-reason option (#764)
* Add close-as-not-planned option * update readme * add to Option enum * improve wording * npm run pack * updates from review * fix tests and improve error message * fix readme order
This commit is contained in:
committed by
GitHub
parent
29e800e1c8
commit
06d2a3904b
12
src/main.ts
12
src/main.ts
@@ -87,7 +87,8 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
|
||||
ignoreUpdates: core.getInput('ignore-updates') === 'true',
|
||||
ignoreIssueUpdates: _toOptionalBoolean('ignore-issue-updates'),
|
||||
ignorePrUpdates: _toOptionalBoolean('ignore-pr-updates'),
|
||||
exemptDraftPr: core.getInput('exempt-draft-pr') === 'true'
|
||||
exemptDraftPr: core.getInput('exempt-draft-pr') === 'true',
|
||||
closeIssueReason: core.getInput('close-issue-reason')
|
||||
};
|
||||
|
||||
for (const numberInput of [
|
||||
@@ -113,6 +114,15 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
|
||||
}
|
||||
}
|
||||
|
||||
const validCloseReasons = ['', 'completed', 'not_planned'];
|
||||
if (!validCloseReasons.includes(args.closeIssueReason)) {
|
||||
const errorMessage = `Unrecognized close-issue-reason "${
|
||||
args.closeIssueReason
|
||||
}", valid values are: ${validCloseReasons.filter(Boolean).join(', ')}`;
|
||||
core.setFailed(errorMessage);
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user