- enhance handling for exhaustive matching

- exhaustive will apply on rules and labels alike
- simplify code
- introduce new testcases to check the new behavior
This commit is contained in:
Mike Penz
2023-01-06 09:13:30 +00:00
committed by GitHub
parent f2b16254cf
commit 50dd476bd1
6 changed files with 170 additions and 238 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ import {PullRequestInfo, retrieveProperty} from './pullRequests'
/**
* Checks if any of the rules match the given PR
*/
export function matchesRules(rules: Rule[], pr: PullRequestInfo, exhaustive: Boolean): Boolean {
export function matchesRules(rules: Rule[], pr: PullRequestInfo, exhaustive: Boolean): boolean {
const transformers: RegexTransformer[] = rules.map(rule => validateTransformer(rule)).filter(t => t !== null) as RegexTransformer[]
if (exhaustive) {
return transformers.every(transformer => {