mirror of
https://github.com/actions/stale.git
synced 2025-12-28 11:08:18 +00:00
Feat: add any-of-labels option (#319)
* feat: add any-of-labels option * chore: run pack script * fix: error in milestones spec * chore: update readme * chore: fix default value in action.yml * chore: add some unit tests * docs: update README.md Co-authored-by: Geoffrey Testelin <geoffrey.testelin@gmail.com> * refactor: add return type to lambda Co-authored-by: Geoffrey Testelin <geoffrey.testelin@gmail.com>
This commit is contained in:
@@ -30,6 +30,7 @@ describe('Issue', (): void => {
|
||||
onlyLabels: '',
|
||||
onlyIssueLabels: '',
|
||||
onlyPrLabels: '',
|
||||
anyOfLabels: '',
|
||||
operationsPerRun: 0,
|
||||
removeStaleWhenUpdated: false,
|
||||
repoToken: '',
|
||||
|
||||
@@ -230,6 +230,19 @@ export class IssuesProcessor {
|
||||
continue; // don't process exempt issues
|
||||
}
|
||||
|
||||
const anyOfLabels: string[] = wordsToList(this.options.anyOfLabels);
|
||||
if (
|
||||
anyOfLabels.length &&
|
||||
!anyOfLabels.some((label: Readonly<string>): boolean =>
|
||||
isLabeled(issue, label)
|
||||
)
|
||||
) {
|
||||
issueLogger.info(
|
||||
`Skipping ${issueType} because it does not have any of the required labels`
|
||||
);
|
||||
continue; // don't process issues without any of the required labels
|
||||
}
|
||||
|
||||
const milestones: Milestones = new Milestones(this.options, issue);
|
||||
|
||||
if (milestones.shouldExemptMilestones()) {
|
||||
|
||||
@@ -21,6 +21,7 @@ export interface IIssuesProcessorOptions {
|
||||
onlyLabels: string;
|
||||
onlyIssueLabels: string;
|
||||
onlyPrLabels: string;
|
||||
anyOfLabels: string;
|
||||
operationsPerRun: number;
|
||||
removeStaleWhenUpdated: boolean;
|
||||
debugOnly: boolean;
|
||||
|
||||
@@ -41,6 +41,7 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
|
||||
onlyLabels: core.getInput('only-labels'),
|
||||
onlyIssueLabels: core.getInput('only-issue-labels'),
|
||||
onlyPrLabels: core.getInput('only-pr-labels'),
|
||||
anyOfLabels: core.getInput('any-of-labels'),
|
||||
operationsPerRun: parseInt(
|
||||
core.getInput('operations-per-run', {required: true})
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user