[Beta] Implement the new structure of the match object for the changed-files section (#680)

* Implement the new structure of the match object for changed files section

* Replace inner loops with the find method
This commit is contained in:
MaksimZhukov
2023-09-20 13:43:39 +02:00
committed by GitHub
parent 4f052778de
commit f4eefdc659
8 changed files with 642 additions and 145 deletions

View File

@@ -236,18 +236,21 @@ export function checkAny(
for (const matchConfig of matchConfigs) {
if (matchConfig.baseBranch) {
if (checkAnyBranch(matchConfig.baseBranch, 'base')) {
core.debug(` "any" patterns matched`);
return true;
}
}
if (matchConfig.changedFiles) {
if (checkAnyChangedFiles(changedFiles, matchConfig.changedFiles)) {
core.debug(` "any" patterns matched`);
return true;
}
}
if (matchConfig.headBranch) {
if (checkAnyBranch(matchConfig.headBranch, 'head')) {
core.debug(` "any" patterns matched`);
return true;
}
}
@@ -274,6 +277,7 @@ export function checkAll(
for (const matchConfig of matchConfigs) {
if (matchConfig.baseBranch) {
if (!checkAllBranch(matchConfig.baseBranch, 'base')) {
core.debug(` "all" patterns did not match`);
return false;
}
}
@@ -285,12 +289,14 @@ export function checkAll(
}
if (!checkAllChangedFiles(changedFiles, matchConfig.changedFiles)) {
core.debug(` "all" patterns did not match`);
return false;
}
}
if (matchConfig.headBranch) {
if (!checkAllBranch(matchConfig.headBranch, 'head')) {
core.debug(` "all" patterns did not match`);
return false;
}
}