From cd6e5598a866b3242fc447e052533b52939838df Mon Sep 17 00:00:00 2001 From: mledour Date: Mon, 22 Jun 2026 05:06:23 -0400 Subject: [PATCH] ci: skip build-and-release on release-please's release PR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit release-please force-updates its release PR (release-please--branches--main) on every push to main, and that PR's pull_request event re-triggers build-and-release.yml. Result: every merge to main produced TWO build runs — the push-to-main build plus a redundant rebuild of the release PR, which only bumps version.txt + CHANGELOG.md (no code). Gate the build job with `if: !startsWith(github.head_ref, 'release-please--')` so release-please PRs no longer build. push and tag events have an empty head_ref and are unaffected; the signed release build still runs on the v*.*.* tag. main has no branch protection, so skipping leaves no required check pending on the release PR. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/build-and-release.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 31871e7..ccd2b90 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -75,10 +75,25 @@ env: jobs: # --------------------------------------------------------------------------- - # Build: Debug + Release in parallel via matrix. Always runs. + # Build: Debug + Release in parallel via matrix. Runs on every feature PR, + # every push to main, and every v*.*.* tag — EXCEPT release-please's own + # release PR (see the `if:` below). # --------------------------------------------------------------------------- build: name: Build ${{ matrix.configuration }} x64 + # Skip this verification build on release-please's release PR + # (head branch `release-please--branches--main`). That PR only bumps + # version.txt + CHANGELOG.md — no code — so a full Windows build + + # snapshot test would merely duplicate the push-to-main build that + # already ran on the same tree when the previous commit landed. Without + # this skip, EVERY push to main costs two build runs: the push build + # plus a re-build of the release PR that release-please force-updates on + # each main push. The real, signed release build still runs later, on + # the v*.*.* tag this PR creates when merged. `github.head_ref` is empty + # for push and tag events, so startsWith() is false there and they build + # as before — only pull_request events from a release-please-* branch + # are skipped. + if: ${{ !startsWith(github.head_ref, 'release-please--') }} runs-on: windows-2022 strategy: fail-fast: false