ci: skip the test suite on release-please Release PRs - #82
Conversation
A Release PR bumps the version and rewrites the changelog. Every source commit in it already passed the suite on the PR it came from, so running it again only delays the release. The guard sits on each job rather than on the calling job in ci.yml: a job skipped by `if:` reports success and satisfies a required status check, while a reusable workflow that is never called produces no check at all and would leave a required one pending forever. The pre-tag gate is unaffected. release.yml triggers on push, where github.head_ref is empty, so the suite still runs before a tag lands.
| # so a skipped job still reports success to a required status check. | ||
| jobs: | ||
| build-and-test: | ||
| if: ${{ !startsWith(github.head_ref, 'release-please--') }} |
There was a problem hiding this comment.
The guard keys on the branch name rather than on who authored the head commit, so a hand-pushed commit onto a Release PR is never tested either. Release PR #81 modifies src/Client.cs and src/stream-feed-net.csproj; if someone pushes a correction onto release-please--branches--master (fixing a changelog entry, correcting a version, resolving a conflict), github.head_ref is unchanged, build-and-test still skips, and that human commit reaches master having run neither dotnet format --verify-no-changes, the build-warning check, nor the tests. It is then caught, if at all, only by release.yml's pre-tag gate, as a stuck release.
There was a problem hiding this comment.
Fixed. github.actor is the pusher rather than the PR author, so it is now the first clause of the guard:
if: >-
${{ !(github.actor == 'github-actions[bot]'
&& github.event.pull_request.user.login == 'github-actions[bot]'
&& github.event.pull_request.head.repo.full_name == github.repository
&& startsWith(github.head_ref, 'release-please--')) }}A correction pushed by hand onto release-please--branches--master makes github.actor that person, the guard fails open, and build-and-test runs. Only release-please's own pushes skip.
The branch-name guard was spoofable: any PR, a fork's included, could name its head branch release-please--x and skip every required check, which branch protection then counts as satisfied. The guard now also requires the PR to be opened by github-actions[bot] from a branch in this repository.
The guard keyed on who opened the PR, so a commit pushed by hand onto the release-please branch, to fix a conflict or a changelog entry, inherited the skip and reached the default branch having run nothing. github.actor is the pusher rather than the PR author, so that commit is now tested like any other and only release-please's own pushes skip.
Ticket
CHA-5511
Problem
release-please opens a Release PR that bumps the version and rewrites the changelog. Every source commit in it already passed this suite on the PR it came from, so the full run on the Release PR only delays the release.
Solution
Guarded here:
build-and-testAll four clauses must hold, and each one fails open, so anything short of a Release PR that release-please both opened and last pushed runs the suite. The branch name alone would not do: any PR, a fork's included, could call its branch
release-please--xand skip every required check, which branch protection counts as satisfied.github.actoris the pusher rather than the PR author, so a human commit pushed onto the Release PR is tested like any other.The pre-tag gate is unaffected:
release.ymltriggers onpush, where there is no pull request, so the suite still runs before a tag lands.Known trade
release-please rewrites the version file, and those bytes appear on no other PR. After this change nothing checks them until
release.yml's pre-tag gate, which runs after the merge, so a broken substitution surfaces as a stuck release needing the manual recovery in the release README rather than as a red check on a PR you close. Accepted: the substitution is the only thing in a Release PR that has not already been tested, and splitting a cheap lint leg out of the combined job in five repos costs more than the failure does.How to verify