mirror of
https://github.com/actions/labeler.git
synced 2025-12-11 03:58:05 +00:00
Run build and fix bad merge
This commit is contained in:
2470
dist/index.js
vendored
2470
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,6 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as github from '@actions/github';
|
||||
import * as yaml from 'js-yaml';
|
||||
import {Minimatch} from 'minimatch';
|
||||
|
||||
import {
|
||||
ChangedFilesMatchConfig,
|
||||
@@ -128,33 +127,27 @@ function getLabelConfigMapFromObject(
|
||||
return labelMap;
|
||||
}
|
||||
|
||||
function printPattern(matcher: Minimatch): string {
|
||||
return (matcher.negate ? '!' : '') + matcher.pattern;
|
||||
export function toMatchConfig(config: any): MatchConfig {
|
||||
const changedFilesConfig = toChangedFilesMatchConfig(config);
|
||||
const branchConfig = toBranchMatchConfig(config);
|
||||
|
||||
return {
|
||||
...changedFilesConfig,
|
||||
...branchConfig
|
||||
};
|
||||
}
|
||||
|
||||
export function checkMatchConfigs(
|
||||
changedFiles: string[],
|
||||
matchConfigs: MatchConfig[]
|
||||
): boolean {
|
||||
for (const glob of globs) {
|
||||
core.debug(` checking pattern ${JSON.stringify(glob)}`);
|
||||
const matchConfig = toMatchConfig(glob);
|
||||
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`);
|
||||
for (const config of matchConfigs) {
|
||||
core.debug(` checking config ${JSON.stringify(config)}`);
|
||||
if (!checkMatch(changedFiles, config)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user