Get all the tests passings

This commit is contained in:
Josh Dales
2023-03-24 22:29:41 -04:00
parent 3bec9227d1
commit 432b275f71
2 changed files with 15 additions and 7 deletions

View File

@@ -63,7 +63,6 @@ function isMatch(changedFile: string, matchers: Minimatch[]): boolean {
return true;
}
// equivalent to "Array.some()" but expanded for debugging and clarity
export function checkAnyChangedFiles(
changedFiles: string[],
globs: string[]
@@ -81,7 +80,6 @@ export function checkAnyChangedFiles(
return false;
}
// equivalent to "Array.every()" but expanded for debugging and clarity
export function checkAllChangedFiles(
changedFiles: string[],
globs: string[]

View File

@@ -167,7 +167,9 @@ export function getLabelConfigMapFromObject(
[]
);
labelMap.set(label, matchConfigs);
if (matchConfigs.length) {
labelMap.set(label, matchConfigs);
}
}
return labelMap;
@@ -203,16 +205,14 @@ function checkMatch(changedFiles: string[], matchConfig: MatchConfig): boolean {
}
if (matchConfig.all) {
// check the options and if anything fails then return false
if (!checkAll(matchConfig.all, changedFiles)) {
return false;
}
}
if (matchConfig.any) {
// Check all the various options if any pass return true
if (checkAny(matchConfig.any, changedFiles)) {
return true;
if (!checkAny(matchConfig.any, changedFiles)) {
return false;
}
}
@@ -225,6 +225,11 @@ export function checkAny(
changedFiles: string[]
): boolean {
core.debug(` checking "any" patterns`);
if (!Object.keys(matchConfigs).length) {
core.debug(` no "any" patterns to check`);
return false;
}
for (const matchConfig of matchConfigs) {
if (matchConfig.baseBranch) {
if (checkAnyBranch(matchConfig.baseBranch, 'base')) {
@@ -255,6 +260,11 @@ export function checkAll(
changedFiles: string[]
): boolean {
core.debug(` checking "all" patterns`);
if (!Object.keys(matchConfigs).length) {
core.debug(` no "all" patterns to check`);
return false;
}
for (const matchConfig of matchConfigs) {
if (matchConfig.baseBranch) {
if (!checkAllBranch(matchConfig.baseBranch, 'base')) {