From 014e0b0fb8f5776cd88b6ef4f867dec34cbca384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Mon, 23 Nov 2026 01:05:16 +0000 Subject: [PATCH] ci: a release whose checks fail fails the required Build, so it cannot merge (#8543) --- .github/workflows/ci.yml | 8 +++++++- scripts/ci/release-only-diff.test.mjs | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efa4cb1eb7..641da1c2fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -324,7 +324,8 @@ jobs: build: name: Build - needs: changes + # Release checks is not a required check; a release whose checks fail must fail this one so it cannot merge. + needs: [changes, release-checks] # A skipped required check passes, so a broken change detection must fail it instead. if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.code == 'true' || needs.changes.outputs.cli_bundle == 'true' || needs.changes.outputs.release_only == 'true') }} runs-on: ubuntu-latest @@ -335,6 +336,11 @@ jobs: run: | echo "::error::Detect changes did not succeed (it also rejects large binaries outside LFS); see its log. This required check cannot pass." exit 1 + - name: Require the release checks + if: needs.changes.outputs.release_diff == 'true' && needs.release-checks.result != 'success' + run: | + echo "::error::Release checks did not succeed (${{ needs.release-checks.result }}); see that job. A release with stale notes or mixed versions cannot merge." + exit 1 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: lfs: true diff --git a/scripts/ci/release-only-diff.test.mjs b/scripts/ci/release-only-diff.test.mjs index 3ab3f7fb0d..dfdccb8aa3 100644 --- a/scripts/ci/release-only-diff.test.mjs +++ b/scripts/ci/release-only-diff.test.mjs @@ -4,6 +4,7 @@ import { mkdirSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { dirname, join } from "node:path"; import { test } from "node:test"; +import { parse } from "yaml"; import { classify } from "./release-only-diff.mjs"; const SCRIPT = new URL("./release-only-diff.mjs", import.meta.url).pathname; @@ -282,6 +283,24 @@ test("--verify refuses manifests that move from different versions", () => { assert.match(run(root, "--verify").stderr, /move from different versions: 0\.8\.1, 0\.8\.0/); }); +// fails without the fix: Release checks is not a required check, so the queue merged v0.9.82 and v0.9.83 while it +// failed on notes that missed a PR merged after the cut. +test("a release whose checks fail cannot merge: the required Build fails with them", () => { + const ci = parse( + readFileSync(new URL("../../.github/workflows/ci.yml", import.meta.url), "utf8"), + ); + const build = ci.jobs.build; + assert.equal(build.name, "Build"); + assert.ok([build.needs].flat().includes("release-checks"), "Build waits for the release checks"); + const gate = build.steps.find((step) => + /needs\.release-checks\.result != 'success'/.test(step.if ?? ""), + ); + assert.ok(gate, "Build has a step that fails when the release checks did not succeed"); + assert.match(gate.if, /needs\.changes\.outputs\.release_diff == 'true'/); + assert.match(gate.run, /exit 1/); + assert.equal(build.steps.indexOf(gate), 1, "it fails before Build spends time building"); +}); + test("the merge queue runs the release checks on a release diff", () => { const ci = readFileSync(new URL("../../.github/workflows/ci.yml", import.meta.url), "utf8"); assert.match(ci, /release-checks:[\s\S]*merge_group[\s\S]*release_diff/);