Run build and fix bad merge

This commit is contained in:
Josh Dales
2023-03-23 09:08:08 -04:00
parent 8e6367ddee
commit 9bfc9998ab
2 changed files with 937 additions and 1564 deletions

2470
dist/index.js vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,6 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as github from '@actions/github'; import * as github from '@actions/github';
import * as yaml from 'js-yaml'; import * as yaml from 'js-yaml';
import {Minimatch} from 'minimatch';
import { import {
ChangedFilesMatchConfig, ChangedFilesMatchConfig,
@@ -128,33 +127,27 @@ function getLabelConfigMapFromObject(
return labelMap; return labelMap;
} }
function printPattern(matcher: Minimatch): string { export function toMatchConfig(config: any): MatchConfig {
return (matcher.negate ? '!' : '') + matcher.pattern; const changedFilesConfig = toChangedFilesMatchConfig(config);
const branchConfig = toBranchMatchConfig(config);
return {
...changedFilesConfig,
...branchConfig
};
} }
export function checkMatchConfigs( export function checkMatchConfigs(
changedFiles: string[], changedFiles: string[],
matchConfigs: MatchConfig[] matchConfigs: MatchConfig[]
): boolean { ): boolean {
for (const glob of globs) { for (const config of matchConfigs) {
core.debug(` checking pattern ${JSON.stringify(glob)}`); core.debug(` checking config ${JSON.stringify(config)}`);
const matchConfig = toMatchConfig(glob); if (!checkMatch(changedFiles, config)) {
if (checkMatch(changedFiles, matchConfig)) {
return true;
}
}
return false;
}
function isMatch(changedFile: string, matchers: Minimatch[]): boolean {
core.debug(` matching patterns against file ${changedFile}`);
for (const matcher of matchers) {
core.debug(` - ${printPattern(matcher)}`);
if (!matcher.match(changedFile)) {
core.debug(` ${printPattern(matcher)} did not match`);
return false; return false;
} }
} }
return true; return true;
} }