Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
USA-RedDragon committed Jul 2, 2024
1 parent 0ba1d88 commit 544f7b2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 26 deletions.
35 changes: 22 additions & 13 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 22 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
try {
const envs = yaml.load(core.getInput("envs"));
const jobs = parseDynamicList(core.getInput("jobs"));
const debug = core.getInput("debug") === 'true';
const debug = core.getInput("debug") === "true";
const matrix = { include: [] };

// Split GitHub ref into type (heads, tags) and ref
Expand All @@ -33,24 +33,33 @@ try {
patterns = value;
} else {
if (value.type === "temp") {
if (debug) core.info(`Temporary Environment`)
if (debug) core.info(`Temporary Environment`);
// Temp environments enabled
if (github.context.eventName === "pull_request") {
const prEvent = github.context.payload;
let matches = false;
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,
);
if (github.context.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(prEvent.pull_request.labels);
}
if (matches) {
if (debug) core.info(`Labels match: ${value.label}`)
if (debug) core.info(`Labels match: ${value.label}`);
patterns = ref;
value.name = `${value.name || toTitleCase(env)} #${prEvent.number}`;
env += prEvent.number;
Expand Down

0 comments on commit 544f7b2

Please sign in to comment.