Skip to content

Commit

Permalink
ci(label): provide precise logs of check runs on skipping build (#3479)
Browse files Browse the repository at this point in the history
  • Loading branch information
clearloop authored Nov 21, 2023
1 parent 40959cc commit 354d660
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions .github/actions/label/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,24 @@ const skip = async ({ core, github }) => {
ref: REF,
});

core.info(`check runs: ${check_runs}`);

const runs = linux
? check_runs.filter(
(run) => run.name === "build" || run.name === "build / linux"
)
: check_runs.filter((run) => run.name === "build / macos-x86");

// Skip this action by default.
let skipped = false;
let skipAction = false;
for (run of runs) {
// Process this action only if the previous build has been skipped.
// If there is already a build, skip this action.
if (
(run.name === "build" && run.conclusion === "skipped")
)
skipped = true;

// If there is already a build, skip this action without more conditions.
if (run.name === "build / linux" || run.name === "build / macos-x86")
return true;
run.name === "build / linux"
|| run.name === "build / macos-x86"
|| (run.name === "build" && run.conclusion !== "skipped")) {
return [true];
}
}

return !skipped;
return [skipAction, JSON.stringify(check_runs, null, 2)];
};

/**
Expand Down Expand Up @@ -147,8 +142,9 @@ const listJobs = async ({ github, core, run_id }) => {
* The main function.
**/
module.exports = async ({ github, core }) => {
if (await skip({ core, github })) {
core.info("Build has already been processed.");
const [skipAction, check_runs] = await skip({ core, github });
if (skipAction) {
core.info("Build has already been processed, check runs: " + check_runs);
return;
}

Expand Down

0 comments on commit 354d660

Please sign in to comment.