From a5bed11d4d1aaf62fcb81f0b5a0a497437f54909 Mon Sep 17 00:00:00 2001 From: Josh Dales Date: Thu, 11 May 2023 17:02:27 -0400 Subject: [PATCH] Run the build command --- dist/index.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/dist/index.js b/dist/index.js index 77ed5bd4..38d5b586 100644 --- a/dist/index.js +++ b/dist/index.js @@ -84,7 +84,7 @@ exports.checkAnyBranch = checkAnyBranch; function checkAllBranch(regexps, branchBase) { const branchName = getBranchName(branchBase); if (!branchName) { - core.debug(` no branch name`); + core.debug(` cannot fetch branch name from the pull request`); return false; } core.debug(` checking "branch" pattern against ${branchName}`); @@ -282,6 +282,7 @@ const github = __importStar(__nccwpck_require__(5438)); const yaml = __importStar(__nccwpck_require__(1917)); const changedFiles_1 = __nccwpck_require__(7358); const branch_1 = __nccwpck_require__(8045); +const ALLOWED_CONFIG_KEYS = ['changed-files', 'head-branch', 'base-branch']; function run() { return __awaiter(this, void 0, void 0, function* () { try { @@ -360,7 +361,7 @@ function getLabelConfigMapFromObject(configObject) { const configOptions = configObject[label]; if (!Array.isArray(configOptions) || !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) => { if (!configValue) { @@ -376,9 +377,7 @@ function getLabelConfigMapFromObject(configObject) { updatedConfig.push({ [key]: newConfigs }); } } - else if ( - // These are the keys that we accept and know how to process - ['changed-files', 'head-branch', 'base-branch'].includes(key)) { + else if (ALLOWED_CONFIG_KEYS.includes(key)) { const newMatchConfig = toMatchConfig({ [key]: value }); // 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. @@ -440,7 +439,7 @@ function checkMatch(changedFiles, matchConfig) { // equivalent to "Array.some()" but expanded for debugging and clarity function checkAny(matchConfigs, changedFiles) { core.debug(` checking "any" patterns`); - if (!Object.keys(matchConfigs).length) { + if (!matchConfigs.length) { core.debug(` no "any" patterns to check`); return false; } @@ -468,7 +467,7 @@ exports.checkAny = checkAny; // equivalent to "Array.every()" but expanded for debugging and clarity function checkAll(matchConfigs, changedFiles) { core.debug(` checking "all" patterns`); - if (!Object.keys(matchConfigs).length) { + if (!matchConfigs.length) { core.debug(` no "all" patterns to check`); return false; } @@ -479,6 +478,10 @@ function checkAll(matchConfigs, 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)) { return false; }