mirror of
https://github.com/actions/labeler.git
synced 2025-12-12 04:27:34 +00:00
Run the build command
This commit is contained in:
17
dist/index.js
vendored
17
dist/index.js
vendored
@@ -84,7 +84,7 @@ exports.checkAnyBranch = checkAnyBranch;
|
|||||||
function checkAllBranch(regexps, branchBase) {
|
function checkAllBranch(regexps, branchBase) {
|
||||||
const branchName = getBranchName(branchBase);
|
const branchName = getBranchName(branchBase);
|
||||||
if (!branchName) {
|
if (!branchName) {
|
||||||
core.debug(` no branch name`);
|
core.debug(` cannot fetch branch name from the pull request`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
core.debug(` checking "branch" pattern against ${branchName}`);
|
core.debug(` checking "branch" pattern against ${branchName}`);
|
||||||
@@ -282,6 +282,7 @@ const github = __importStar(__nccwpck_require__(5438));
|
|||||||
const yaml = __importStar(__nccwpck_require__(1917));
|
const yaml = __importStar(__nccwpck_require__(1917));
|
||||||
const changedFiles_1 = __nccwpck_require__(7358);
|
const changedFiles_1 = __nccwpck_require__(7358);
|
||||||
const branch_1 = __nccwpck_require__(8045);
|
const branch_1 = __nccwpck_require__(8045);
|
||||||
|
const ALLOWED_CONFIG_KEYS = ['changed-files', 'head-branch', 'base-branch'];
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
@@ -360,7 +361,7 @@ function getLabelConfigMapFromObject(configObject) {
|
|||||||
const configOptions = configObject[label];
|
const configOptions = configObject[label];
|
||||||
if (!Array.isArray(configOptions) ||
|
if (!Array.isArray(configOptions) ||
|
||||||
!configOptions.every(opts => typeof opts === 'object')) {
|
!configOptions.every(opts => typeof opts === 'object')) {
|
||||||
throw Error(`found unexpected type for label ${label} (should be array of config options)`);
|
throw Error(`found unexpected type for label '${label}' (should be array of config options)`);
|
||||||
}
|
}
|
||||||
const matchConfigs = configOptions.reduce((updatedConfig, configValue) => {
|
const matchConfigs = configOptions.reduce((updatedConfig, configValue) => {
|
||||||
if (!configValue) {
|
if (!configValue) {
|
||||||
@@ -376,9 +377,7 @@ function getLabelConfigMapFromObject(configObject) {
|
|||||||
updatedConfig.push({ [key]: newConfigs });
|
updatedConfig.push({ [key]: newConfigs });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (
|
else if (ALLOWED_CONFIG_KEYS.includes(key)) {
|
||||||
// These are the keys that we accept and know how to process
|
|
||||||
['changed-files', 'head-branch', 'base-branch'].includes(key)) {
|
|
||||||
const newMatchConfig = toMatchConfig({ [key]: value });
|
const newMatchConfig = toMatchConfig({ [key]: value });
|
||||||
// Find or set the `any` key so that we can add these properties to that rule,
|
// Find or set the `any` key so that we can add these properties to that rule,
|
||||||
// Or create a new `any` key and add that to our array of configs.
|
// Or create a new `any` key and add that to our array of configs.
|
||||||
@@ -440,7 +439,7 @@ function checkMatch(changedFiles, matchConfig) {
|
|||||||
// equivalent to "Array.some()" but expanded for debugging and clarity
|
// equivalent to "Array.some()" but expanded for debugging and clarity
|
||||||
function checkAny(matchConfigs, changedFiles) {
|
function checkAny(matchConfigs, changedFiles) {
|
||||||
core.debug(` checking "any" patterns`);
|
core.debug(` checking "any" patterns`);
|
||||||
if (!Object.keys(matchConfigs).length) {
|
if (!matchConfigs.length) {
|
||||||
core.debug(` no "any" patterns to check`);
|
core.debug(` no "any" patterns to check`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -468,7 +467,7 @@ exports.checkAny = checkAny;
|
|||||||
// equivalent to "Array.every()" but expanded for debugging and clarity
|
// equivalent to "Array.every()" but expanded for debugging and clarity
|
||||||
function checkAll(matchConfigs, changedFiles) {
|
function checkAll(matchConfigs, changedFiles) {
|
||||||
core.debug(` checking "all" patterns`);
|
core.debug(` checking "all" patterns`);
|
||||||
if (!Object.keys(matchConfigs).length) {
|
if (!matchConfigs.length) {
|
||||||
core.debug(` no "all" patterns to check`);
|
core.debug(` no "all" patterns to check`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -479,6 +478,10 @@ function checkAll(matchConfigs, changedFiles) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (matchConfig.changedFiles) {
|
if (matchConfig.changedFiles) {
|
||||||
|
if (!changedFiles.length) {
|
||||||
|
core.debug(` no files to check "changed-files" patterns against`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!(0, changedFiles_1.checkAllChangedFiles)(changedFiles, matchConfig.changedFiles)) {
|
if (!(0, changedFiles_1.checkAllChangedFiles)(changedFiles, matchConfig.changedFiles)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user