Repository navigation
ci(release): prepare installation guides on minor release PRs - #93
Merged
Merged
Conversation
Owner
Author
|
@coderabbitai review |
Action performed
|
jimeh
marked this pull request as ready for review
November 16, 2026 18:55
After Release Please runs on main, find the open release PR, read its head as data from a trusted main checkout, and commit any guide changes that release:prepare would make through GraphQL createCommitOnBranch with the release App token. GitHub signs the commit, expectedHeadOid makes a moved branch fail instead of being overwritten, and a rebuild that drops the commit gets it back in the same run. Patch releases and runs without an open release PR change nothing. Closes #90
…exactly Take the prepared head from the branch ref that createCommitOnBranch compares against, since a PR's head.sha can lag the push that just rebuilt the branch. Require the exact Release Please workflow ref on main instead of a substring that also matched branches such as maintenance, and cover the prepare-pr command end to end through a stub gh.
jimeh
force-pushed
the
ci/auto-release-prepare
branch
from
November 16, 2026 19:19
a2d2476 to
a712174
Compare
21 of 29 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Minor release PRs failed CI until someone ran
mise run release:prepareon theRelease Please branch and pushed a signed commit, because the installation
guides keep quoting the previous
~> 0.<minor>.0requirement. Release Pleasealso drops that commit whenever it rebuilds its branch from main, so the manual
step had to be repeated after every releasable merge (#90).
The Release Please job now prepares the release PR itself after
release-please-actionruns:release-please--branches--main--components--connectrpcinto main throughthe REST API, filtering on this repository's owner, so fork PRs never match.
It then reads the head SHA from the branch ref, which is what
createCommitOnBranchcompares against. A PR'shead.shacan lag a pushthat just rebuilt the branch.
The lookup does not use the action's
proutput, because Release Pleasereports no PR when the body is unchanged (release-please v17.6.0,
Manifest#maybeUpdateExistingPullRequest). Because of that, the next push tomain or a manual dispatch retries a failed preparation.
release-pras data,both with
persist-credentials: false.mise run release:prepare:pr(newReleasePreparationinscripts/release_preparation.rb) confirms the release checkout is that SHA,then reads its core version file and guides as text. It applies the same
transformation
release:prepareuses (nowReleaseTrain#prepared_guide).If any guide changes, it commits exactly those files to the release branch
with GraphQL
createCommitOnBranchand the release App token.expectedHeadOidis the checked-out SHA, so a branch that moved since thelookup fails the run instead of being overwritten.
Patch releases and runs with no open release PR make no commit. When Release
Please later rebuilds the branch, its force push drops the preparation commit,
and the same run commits it again. Release Please compares only the PR body, so
the extra commit does not affect its next update.
Design decisions
token and runs in the main-only
release-pleaseenvironment. Runningmise run release:preparein the release checkout would execute thatbranch's
mise.toml, scripts and gemspecs (check_versions!loads gemspecs).Main's tooling therefore reads the release tree as text, and refuses a guide
that is not a regular file inside the tree (a symlink could otherwise put
runner files into a signed commit). The tooling also comes from main, so a
release branch created before this change, such as chore(main): release 0.2.0 #80, needs no new files.
The release PR's own CI still runs
release:checkagainst the full tree.authenticated as the GitHub App and carries no custom author, committer or
signature.
createCommitOnBranchtakes no author input.GITHUB_TOKENdo notstart new workflow runs, and that an App installation token can be used
instead. The App-token commit should therefore start the PR's CI.
ci.ymlconcurrency then cancels the run for the bot's superseded push.
contents: write, which iswhat the mutation needs. Guides are outside
.github/workflows, so noworkflowspermission is needed. Workflow-levelpermissions: {}isunchanged, and the token reaches only the lookup step, the two checkouts
(with no persisted credentials) and the commit step. No repository settings,
secrets, rulesets or App installation changed. The existing ruleset with
signed-commit enforcement targets only main, so the release branch is not
gated by it today; a signed commit there is still the intent.
~> M.m.0without changing the guide convention or adding visible markers tocopy-paste snippets.
docs/releasing.mdnow describes the automatic step, keepsmise run release:prepareas a local fallback with normal signing, and replacesthe "re-run preparation after every bot regeneration" warning with "validate
the final head after every regeneration".
Verification
On head a2d2476:
mise run test -- spec/release_preparation_spec.rb spec/release_train_spec.rb:25 examples, 0 failures, including 12 new examples. 11 are in
spec/release_preparation_spec.rb, and one is the workflow-boundariesexample "prepares the open release PR from main tooling after Release Please".
ReleasePreparationruns against a throwaway Git repository holding therelease train's inputs at a proposed minor version. It is checked against
what
release:preparewrites on a copy of the same tree, and the releasetree must stay unmodified, with no gemspec loaded. A fake GitHub adapter
records the mutation input.
ruby scripts/release.rb prepare-pralso runs end to end in a subprocess,with a stub
ghonPATH, and the spec checks the GraphQL body itreceives.
head and of a symlinked guide before any API call; a guide missing from an
older release tree is skipped;
gh api graphql --input -payload, non-zeroexit, GraphQL
errorsand missing-commit handling; and the exactworkflow-ref guard (other workflow, other branch, a branch name starting
with
main, other repository).examples, removing the symlink guard failed its example, a substring
workflow-ref guard failed the prefixed-branch case, and passing the main
tree instead of
RELEASE_ROOTfailed the end-to-end example. Each failed atthe intended assertion, and passed again once the code was restored.
mise run check(format, lint,lint:workflowswith actionlint and zizmor,release:check, syntax): passed.On head 29d0fa3, before the follow-up fix, which changes only the
release-preparation script, workflow step and specs:
mise run verify: passed. Core 1091, Rails 53, Async 930 and Falcon 404examples, all with 0 failures. An earlier run hit a Ruby 3.4.12 segfault in an
Open3reader thread after the core suite finished, and a grpc-goEOFpanicin
async:interop:keepalive. Neither involves code this change touches, andboth steps passed when rerun alone and in the full rerun.
mise run rack:verify: passed.Only a real minor release run can prove the GitHub-side behavior: that the App
token can check out and commit on the release branch, that GitHub marks the
commit verified, that the push starts CI on the PR, and how a later Release
Please rebuild interacts with it.
Closes #90
Written on behalf of jimeh by
claude-opus-5-5usingClaude CodeviaT3 Code.