mirror of
https://github.com/actions/stale.git
synced 2025-12-10 12:07:09 +00:00
Issue 596/include only assigned (#817)
* Add new 'include-only-assigned' option If set, only issues containing assignees will be processed * Test new flag * Update code comment * Update src/classes/issues-processor.ts Co-authored-by: Francesco Renzi <rentziass@github.com> * Update index.js with typo fix Co-authored-by: Francesco Renzi <rentziass@github.com>
This commit is contained in:
@@ -62,7 +62,8 @@ describe('Issue', (): void => {
|
||||
ignoreIssueUpdates: undefined,
|
||||
ignorePrUpdates: undefined,
|
||||
exemptDraftPr: false,
|
||||
closeIssueReason: ''
|
||||
closeIssueReason: '',
|
||||
includeOnlyAssigned: false
|
||||
};
|
||||
issueInterface = {
|
||||
title: 'dummy-title',
|
||||
|
||||
@@ -221,6 +221,14 @@ export class IssuesProcessor {
|
||||
return; // Don't process locked issues
|
||||
}
|
||||
|
||||
if (this._isIncludeOnlyAssigned(issue)) {
|
||||
issueLogger.info(
|
||||
`Skipping this $$type because its assignees list is empty`
|
||||
);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
return; // If the issue has an 'include-only-assigned' option set, 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 !== '') {
|
||||
|
||||
@@ -52,4 +52,5 @@ export interface IIssuesProcessorOptions {
|
||||
ignorePrUpdates: boolean | undefined;
|
||||
exemptDraftPr: boolean;
|
||||
closeIssueReason: string;
|
||||
includeOnlyAssigned: boolean;
|
||||
}
|
||||
|
||||
@@ -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 [
|
||||
|
||||
Reference in New Issue
Block a user