Update tests and build

This commit is contained in:
Josh Dales
2023-05-05 08:58:23 -04:00
parent 11812c37f6
commit 9488def29a
2 changed files with 17 additions and 5 deletions

18
dist/index.js vendored
View File

@@ -186,7 +186,19 @@ exports.toChangedFilesMatchConfig = toChangedFilesMatchConfig;
function printPattern(matcher) {
return (matcher.negate ? '!' : '') + matcher.pattern;
}
function isMatch(changedFile, matchers) {
function isAnyMatch(changedFile, matchers) {
core.debug(` matching patterns against file ${changedFile}`);
for (const matcher of matchers) {
core.debug(` - ${printPattern(matcher)}`);
if (matcher.match(changedFile)) {
core.debug(` ${printPattern(matcher)} matched`);
return true;
}
}
core.debug(` no patterns matched`);
return false;
}
function isAllMatch(changedFile, matchers) {
core.debug(` matching patterns against file ${changedFile}`);
for (const matcher of matchers) {
core.debug(` - ${printPattern(matcher)}`);
@@ -201,7 +213,7 @@ function isMatch(changedFile, matchers) {
function checkAnyChangedFiles(changedFiles, globs) {
const matchers = globs.map(g => new minimatch_1.Minimatch(g));
for (const changedFile of changedFiles) {
if (isMatch(changedFile, matchers)) {
if (isAnyMatch(changedFile, matchers)) {
core.debug(` "any" patterns matched against ${changedFile}`);
return true;
}
@@ -213,7 +225,7 @@ exports.checkAnyChangedFiles = checkAnyChangedFiles;
function checkAllChangedFiles(changedFiles, globs) {
const matchers = globs.map(g => new minimatch_1.Minimatch(g));
for (const changedFile of changedFiles) {
if (!isMatch(changedFile, matchers)) {
if (!isAllMatch(changedFile, matchers)) {
core.debug(` "all" patterns did not match against ${changedFile}`);
return false;
}