mirror of
https://github.com/actions/labeler.git
synced 2025-12-12 20:51:42 +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 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user