diff --git a/dist/index.js b/dist/index.js index 18754b23..b247d32b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -476,6 +476,11 @@ class IssuesProcessor { IssuesProcessor._endIssueProcessing(issue); return; // Don't process locked issues } + if (this._isIncludeOnlyAssigned(issue)) { + issueLogger.info(`Skipping this $$type because it's assignees list is empty`); + IssuesProcessor._endIssueProcessing(issue); + return; // If the issue has an 'includeOnlyAssigned' option, process only issues with nonempty assignees list + } const onlyLabels = words_to_list_1.wordsToList(this._getOnlyLabels(issue)); if (onlyLabels.length > 0) { issueLogger.info(`The option ${issueLogger.createOptionLink(option_1.Option.OnlyLabels)} was specified to only process issues and pull requests with all those labels (${logger_service_1.LoggerService.cyan(onlyLabels.length)})`); @@ -988,6 +993,9 @@ class IssuesProcessor { } return this.options.onlyLabels; } + _isIncludeOnlyAssigned(issue) { + return this.options.includeOnlyAssigned && !issue.hasAssignees; + } _getAnyOfLabels(issue) { if (issue.isPullRequest) { if (this.options.anyOfPrLabels !== '') { @@ -2207,7 +2215,8 @@ function _getAndValidateArgs() { ignoreIssueUpdates: _toOptionalBoolean('ignore-issue-updates'), ignorePrUpdates: _toOptionalBoolean('ignore-pr-updates'), exemptDraftPr: core.getInput('exempt-draft-pr') === 'true', - closeIssueReason: core.getInput('close-issue-reason') + closeIssueReason: core.getInput('close-issue-reason'), + includeOnlyAssigned: core.getInput('include-only-assigned') === 'true' }; for (const numberInput of [ 'days-before-stale', diff --git a/src/classes/issues-processor.ts b/src/classes/issues-processor.ts index d0397ebc..e5b657c4 100644 --- a/src/classes/issues-processor.ts +++ b/src/classes/issues-processor.ts @@ -221,6 +221,14 @@ export class IssuesProcessor { return; // Don't process locked issues } + if (this._isIncludeOnlyAssigned(issue)) { + issueLogger.info( + `Skipping this $$type because it's assignees list is empty` + ); + IssuesProcessor._endIssueProcessing(issue); + return; // If the issue has an 'include-only-assigned' option, process only issues with nonempty assignees list + } + const onlyLabels: string[] = wordsToList(this._getOnlyLabels(issue)); if (onlyLabels.length > 0) { @@ -1012,6 +1020,10 @@ export class IssuesProcessor { return this.options.onlyLabels; } + private _isIncludeOnlyAssigned(issue: Issue): boolean { + return this.options.includeOnlyAssigned && !issue.hasAssignees; + } + private _getAnyOfLabels(issue: Issue): string { if (issue.isPullRequest) { if (this.options.anyOfPrLabels !== '') { diff --git a/src/interfaces/issues-processor-options.ts b/src/interfaces/issues-processor-options.ts index 496584e8..b056a28c 100644 --- a/src/interfaces/issues-processor-options.ts +++ b/src/interfaces/issues-processor-options.ts @@ -52,4 +52,5 @@ export interface IIssuesProcessorOptions { ignorePrUpdates: boolean | undefined; exemptDraftPr: boolean; closeIssueReason: string; + includeOnlyAssigned: boolean; } diff --git a/src/main.ts b/src/main.ts index 770aa116..4b7adeab 100644 --- a/src/main.ts +++ b/src/main.ts @@ -88,7 +88,8 @@ function _getAndValidateArgs(): IIssuesProcessorOptions { ignoreIssueUpdates: _toOptionalBoolean('ignore-issue-updates'), ignorePrUpdates: _toOptionalBoolean('ignore-pr-updates'), exemptDraftPr: core.getInput('exempt-draft-pr') === 'true', - closeIssueReason: core.getInput('close-issue-reason') + closeIssueReason: core.getInput('close-issue-reason'), + includeOnlyAssigned: core.getInput('include-only-assigned') === 'true' }; for (const numberInput of [