CodeIssuesPull RequestsActionsSecurityInsights
✨ AI
More
Settings

fix(ci): two false greens — a job that ran nothing, and a failing line that didn't fail #5594

MergedXSccantynz wants to mergefix/ci-no-steps-executedmainopened 1d ago
2 changed files+29−2
Modifiedsrc/__tests__/ci-no-steps-executed.test.ts+18−0View fileUnifiedSplit
6767 expect(step.slice(0, 260)).toMatch(/status: "skipped"/);
6868 });
6969});
70
71describe("a failing line fails the step", () => {
72 it("runs steps under `bash -ec`, not `bash -c`", async () => {
73 // Without -e, a multi-line `run:` continues past a failing line and the
74 // step's exit code is the LAST command's — so a build that failed in the
75 // middle reported success. Same family as the all-`uses:` job above and
76 // as the `| tail` bug Vapron found in its own gate driver: the exit code
77 // being reported is not the exit code that matters.
78 const src = await Bun.file(
79 require("path").resolve("src/lib/workflow-runner.ts")
80 ).text();
81 expect(src).toMatch(/"bash", "-ec", run/);
82 expect(src).toMatch(/"nice", "-n", "10", "bash", "-ec", run/);
83 // And the old form must not survive anywhere in the spawn path.
84 const spawn = src.slice(src.indexOf("const stepCmd ="), src.indexOf("const stepCmd =") + 400);
85 expect(spawn).not.toMatch(/"bash", "-c"/);
86 });
87});
Modifiedsrc/lib/workflow-runner.ts+11−2View fileUnifiedSplit
574574 // the app serving traffic beside it (INCIDENT 2026-08-22 — CI starved
575575 // the platform's own request handlers). Windows dev has no `nice`; the
576576 // step runs unniced there, which only ever affects a dev machine.
577 // `-ec`, not `-c`. Without -e a multi-line `run:` keeps going after a
578 // failing line and the step's exit code is the LAST command's — so a build
579 // that failed in the middle reports success. GitHub Actions uses
580 // `bash -e` for exactly this reason, and the platform this repo's own
581 // gate driver was caught doing the `| tail` version of the same mistake.
582 //
583 // This is a behaviour change: a workflow that (knowingly or not) relied on
584 // a failing line being ignored will now go red. That is the correct
585 // direction — it was already failing, we were just not saying so.
577586 const stepCmd =
578587 process.platform === "win32"
579 ? ["bash", "-c", run]
580 : ["nice", "-n", "10", "bash", "-c", run];
588 ? ["bash", "-ec", run]
589 : ["nice", "-n", "10", "bash", "-ec", run];
581590 proc = Bun.spawn(stepCmd, {
582591 cwd: checkoutDir,
583592 stdout: "pipe",
584593
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts