diff --git a/action.yml b/action.yml index 94d79d9..fcbe9ac 100644 --- a/action.yml +++ b/action.yml @@ -13,10 +13,6 @@ inputs: description: List/CSV of jobs to deploy per environment. required: false default: app - debug: - description: Adds debug logging to the output - required: false - default: "false" outputs: matrix: description: Matrix JSON to be used in another job. diff --git a/dist/index.js b/dist/index.js index a8cfd3e..a28d91a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -36925,17 +36925,10 @@ const parseDynamicList = (s) => { try { const envs = js_yaml.load(core.getInput("envs")); const jobs = parseDynamicList(core.getInput("jobs")); - const debug = core.getInput("debug") === "true"; const matrix = { include: [] }; // Split GitHub ref into type (heads, tags) and ref const [, type, ref] = github.context.ref.match(/^refs\/(.+)\/(.+)$/); - if (debug) { - core.info(`Type: "${type}"`); - core.info(`Ref: "${ref}"`); - core.info(`Event: "${github.context.eventName}"`); - core.info(`Event action: "${github.context.payload.action}"`); - } let count = 0; for (let [env, value] of Object.entries(envs)) { @@ -36948,36 +36941,28 @@ try { patterns = value; } else { if (value.type === "temp") { - if (debug) core.info(`Temporary Environment`); // Temp environments enabled if (github.context.eventName === "pull_request") { const prEvent = github.context.payload; let matches = false; if (prEvent.action !== "closed") { if (value.label) { - if (debug) - core.info(`Pull Request Event: Labelled: ${value.label}`); matches = prEvent.pull_request.labels.some( (label) => label.name === value.label, ); } else if (value.removed_label) { - if (debug) - core.info( - `Pull Request Event: Unlabelled: ${value.removed_label}`, - ); matches = !prEvent.pull_request.labels.some( (label) => label.name === value.removed_label, ); } } else { - if (debug) core.info("Closed PR event"); - if (debug) core.info(js_yaml.dump(prEvent.pull_request.labels)); - matches = !prEvent.pull_request.labels.some( + // Closed PR, check if the removed label is on it + matches = prEvent.pull_request.labels.some( (label) => label.name === value.removed_label, ); } if (matches) { - if (debug) core.info(`Labels match: ${value.label}`); + core.info(`Labels match: ${value.label}`); patterns = ref; value.name = `${value.name || toTitleCase(env)} #${prEvent.number}`; env += prEvent.number; @@ -36996,9 +36981,7 @@ try { } } - if (debug) { - core.info(`Patterns: "${patterns}"`); - } + core.info(`Patterns: "${patterns}"`); extraValues = { ...value }; delete extraValues.branch; diff --git a/src/index.js b/src/index.js index 7bc01c6..d5cc89d 100644 --- a/src/index.js +++ b/src/index.js @@ -12,17 +12,10 @@ import { try { const envs = yaml.load(core.getInput("envs")); const jobs = parseDynamicList(core.getInput("jobs")); - const debug = core.getInput("debug") === "true"; const matrix = { include: [] }; // Split GitHub ref into type (heads, tags) and ref const [, type, ref] = github.context.ref.match(/^refs\/(.+)\/(.+)$/); - if (debug) { - core.info(`Type: "${type}"`); - core.info(`Ref: "${ref}"`); - core.info(`Event: "${github.context.eventName}"`); - core.info(`Event action: "${github.context.payload.action}"`); - } let count = 0; for (let [env, value] of Object.entries(envs)) { @@ -35,36 +28,28 @@ try { patterns = value; } else { if (value.type === "temp") { - if (debug) core.info(`Temporary Environment`); // Temp environments enabled if (github.context.eventName === "pull_request") { const prEvent = github.context.payload; let matches = false; if (prEvent.action !== "closed") { if (value.label) { - if (debug) - core.info(`Pull Request Event: Labelled: ${value.label}`); matches = prEvent.pull_request.labels.some( (label) => label.name === value.label, ); } else if (value.removed_label) { - if (debug) - core.info( - `Pull Request Event: Unlabelled: ${value.removed_label}`, - ); matches = !prEvent.pull_request.labels.some( (label) => label.name === value.removed_label, ); } } else { - if (debug) core.info("Closed PR event"); - if (debug) core.info(yaml.dump(prEvent.pull_request.labels)); - matches = !prEvent.pull_request.labels.some( + // Closed PR, check if the removed label is on it + matches = prEvent.pull_request.labels.some( (label) => label.name === value.removed_label, ); } if (matches) { - if (debug) core.info(`Labels match: ${value.label}`); + core.info(`Labels match: ${value.label}`); patterns = ref; value.name = `${value.name || toTitleCase(env)} #${prEvent.number}`; env += prEvent.number; @@ -83,9 +68,7 @@ try { } } - if (debug) { - core.info(`Patterns: "${patterns}"`); - } + core.info(`Patterns: "${patterns}"`); extraValues = { ...value }; delete extraValues.branch;