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:
Jose Veiga
2021-03-01 11:05:53 -05:00
committed by GitHub
parent 8f5f223d0c
commit 63ae8ac024
9 changed files with 205 additions and 43 deletions

View File

@@ -30,6 +30,7 @@ describe('Issue', (): void => {
onlyLabels: '',
onlyIssueLabels: '',
onlyPrLabels: '',
anyOfLabels: '',
operationsPerRun: 0,
removeStaleWhenUpdated: false,
repoToken: '',

View File

@@ -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()) {