Skip to content

ci(release): prepare installation guides on minor release PRs - #93

Merged
jimeh merged 2 commits into
mainfrom
ci/auto-release-prepare
Nov 16, 2026
Merged

jimeh merged 2 commits into
mainfrom
ci/auto-release-prepare

Conversation

@jimeh

@jimeh jimeh commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Change

Minor release PRs failed CI until someone ran mise run release:prepare on the
Release Please branch and pushed a signed commit, because the installation
guides keep quoting the previous ~> 0.<minor>.0 requirement. Release Please
also 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-action runs:

  1. It looks up the open PR from
    release-please--branches--main--components--connectrpc into main through
    the 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
    createCommitOnBranch compares against. A PR's head.sha can lag a push
    that just rebuilt the branch.
    The lookup does not use the action's pr output, because Release Please
    reports no PR when the body is unchanged (release-please v17.6.0,
    Manifest#maybeUpdateExistingPullRequest). Because of that, the next push to
    main or a manual dispatch retries a failed preparation.
  2. It checks out main as tooling and that SHA into release-pr as data,
    both with persist-credentials: false.
  3. mise run release:prepare:pr (new ReleasePreparation in
    scripts/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:prepare uses (now ReleaseTrain#prepared_guide).
    If any guide changes, it commits exactly those files to the release branch
    with GraphQL createCommitOnBranch and the release App token.
    expectedHeadOid is the checked-out SHA, so a branch that moved since the
    lookup 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

  • No release-branch code runs in the privileged job. The job holds the App
    token and runs in the main-only release-please environment. Running
    mise run release:prepare in the release checkout would execute that
    branch'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:check against the full tree.
  • Signing. GitHub marks a bot commit verified when the request is
    authenticated as the GitHub App and carries no custom author, committer or
    signature. createCommitOnBranch takes no author input.
  • Triggering CI. GitHub documents that events from GITHUB_TOKEN do not
    start 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.yml
    concurrency then cancels the run for the bot's superseded push.
  • Permissions. The App token already requests contents: write, which is
    what the mutation needs. Guides are outside .github/workflows, so no
    workflows permission is needed. Workflow-level permissions: {} is
    unchanged, 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.
  • Release Please's generic updater markers were rejected: they cannot produce
    ~> M.m.0 without changing the guide convention or adding visible markers to
    copy-paste snippets.

docs/releasing.md now describes the automatic step, keeps
mise run release:prepare as a local fallback with normal signing, and replaces
the "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-boundaries
    example "prepares the open release PR from main tooling after Release Please".
    • ReleasePreparation runs against a throwaway Git repository holding the
      release train's inputs at a proposed minor version. It is checked against
      what release:prepare writes on a copy of the same tree, and the release
      tree must stay unmodified, with no gemspec loaded. A fake GitHub adapter
      records the mutation input.
    • ruby scripts/release.rb prepare-pr also runs end to end in a subprocess,
      with a stub gh on PATH, and the spec checks the GraphQL body it
      receives.
    • Also covered: no API call for a patch release; refusal of an unexpected
      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-zero
      exit, GraphQL errors and missing-commit handling; and the exact
      workflow-ref guard (other workflow, other branch, a branch name starting
      with main, other repository).
    • Perturbations: committing unchanged guides failed the minor and patch
      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_ROOT failed the end-to-end example. Each failed at
      the intended assertion, and passed again once the code was restored.
  • mise run check (format, lint, lint:workflows with 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 404
    examples, all with 0 failures. An earlier run hit a Ruby 3.4.12 segfault in an
    Open3 reader thread after the core suite finished, and a grpc-go EOF panic
    in async:interop:keepalive. Neither involves code this change touches, and
    both 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-5 using Claude Code via T3 Code.

@jimeh

jimeh commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Minor release pull requests now automatically receive updated installation guides when needed. Changes are committed to the release branch, with safeguards to avoid applying them to an outdated branch.
  • Documentation
    • Updated the release guide to explain automatic guide preparation, the local fallback, and how regenerated release branches can affect preparation commits and manual edits.

The Release Please workflow now prepares changed installation guides for an open release PR and commits them through the GitHub API. The preparation task checks its workflow context and the release checkout’s head before submitting changes.

Changes: Release guide preparation

Layer / File(s) Summary
Prepare guides and create the commit
scripts/release_train.rb, scripts/release_preparation.rb, spec/release_preparation_spec.rb
Guide preparation now accepts supplied text. ReleasePreparation checks the expected checkout head, selects changed guides, and submits additions through createCommitOnBranch. Specs cover changed and missing guides, head validation, symlinks, and API failures.
Gate and run preparation for the release PR
.github/workflows/release-please.yml, mise.toml, scripts/release.rb, spec/release_preparation_spec.rb, spec/release_train_spec.rb, docs/releasing.md
The CI-only task is restricted to the Release Please workflow on main. The workflow finds the open release PR, checks out its head, and runs preparation. Specs cover the command restrictions and workflow wiring. The releasing guide documents the flow, permissions, fallback, and commit behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Workflow as Release Please workflow
  participant GitHub
  participant Task as mise release:prepare:pr
  participant Command as scripts/release.rb
  participant Preparation as ReleasePreparation
  participant Train as ReleaseTrain
  participant GraphQL as GitHub GraphQL API
  Workflow->>GitHub: Find open release PR and read head SHA
  Workflow->>Task: Run preparation with release head and checkout path
  Task->>Command: Invoke prepare-pr
  Command->>Preparation: Create preparation for repository and head
  Preparation->>Train: Prepare guide contents
  Preparation->>GraphQL: Submit changed guides with expected head OID
  GraphQL-->>Preparation: Return commit OID
Loading
Merge Risk: Minimal · up to a2d24

This change automatically prepares installation guides on minor release PRs and leaves patch releases untouched. No concrete defect was found in the supplied changes. It is worth watching the first real minor-release run to confirm GitHub permissions and commit verification.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "ci(release): prepare installation guides on minor release PRs" follows the conventional commits format (type ci, scope release, description). It matches the main change: the release workflo…
Description check Passed The description follows the template. It has a Change section that describes the problem, the resulting behavior, and the design boundaries (privileged job, signing, permissions). It has a Verificatio…
Linked Issues check Passed Issue #90 has three coding-relevant acceptance criteria. (1) Minor release PRs need no manual preparation commit. The workflow change in .github/workflows/release-please.yml runs after release-please-…
Out of Scope Changes check Passed The changed files map to the #90 objective or its direct support. .github/workflows/release-please.yml adds the preparation step, its gating, and the checkouts. scripts/release_preparation.rb and scri…
Full details: Title check

Explanation

The title "ci(release): prepare installation guides on minor release PRs" follows the conventional commits format (type ci, scope release, description). It matches the main change: the release workflow now prepares installation guides on minor release PRs via the new release:prepare:pr task and ReleasePreparation class.

Full details: Description check

Explanation

The description follows the template. It has a Change section that describes the problem, the resulting behavior, and the design boundaries (privileged job, signing, permissions). It has a Verification section that lists commands, example counts, head SHAs, perturbation checks, and the limits of what was verified (no real minor release run yet). Both required headings are present and substantively filled.

Full details: Linked Issues check

Explanation

Issue #90 has three coding-relevant acceptance criteria. (1) Minor release PRs need no manual preparation commit. The workflow change in .github/workflows/release-please.yml runs after release-please-action, finds the open release PR, and runs mise run release:prepare:pr. scripts/release_preparation.rb (ReleasePreparation#commit!) commits only changed guides through createCommitOnBranch with expectedHeadOid. Spec coverage in spec/release_preparation_spec.rb and spec/release_train_spec.rb checks the minor-release path and the workflow wiring. The live GitHub-side result (App-token checkout and commit, verified signature, CI start) is not yet proven by a real release run, as the PR description states. (2) Patch releases change only version files, manifest, and changelog. ReleasePreparation makes no API call when no guide changes, and a spec covers the patch case. (3) docs/releasing.md describes the automatic step and keeps mise run release:prepare as the local fallback. The implemented requirements are met at the reviewed head. Runtime behavior remains unverified and is noted for the first real minor release.

Full details: Out of Scope Changes check

Explanation

The changed files map to the #90 objective or its direct support. .github/workflows/release-please.yml adds the preparation step, its gating, and the checkouts. scripts/release_preparation.rb and scripts/release.rb (prepare-pr) implement the commit. scripts/release_train.rb extracts prepared_guide(content) so both paths share the same transformation. mise.toml adds the release:prepare:pr task. docs/releasing.md documents the flow. The spec files test these changes. The workflow-wide MISE_ENV=ci and MISE_LOCKED settings support the new mise task in CI. No change was found that is unrelated to #90.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Team
  • Run ID: f025d6f5-46b9-4fc3-b251-f5c1ab868eef
Commits

Reviewing files that changed from the base of the PR and between 8a522b5 and a2d2476.

Files selected for processing: 8

  • .github/workflows/release-please.yml
  • docs/releasing.md
  • mise.toml
  • scripts/release.rb
  • scripts/release_preparation.rb
  • scripts/release_train.rb
  • spec/release_preparation_spec.rb
  • spec/release_train_spec.rb

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 6 reviews per hour.

@jimeh
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
jimeh force-pushed the ci/auto-release-prepare branch from a2d2476 to a712174 Compare November 16, 2026 19:19
@jimeh
jimeh merged commit 8ca2b1f into main Nov 16, 2026
49 checks passed
@jimeh
jimeh deleted the ci/auto-release-prepare branch November 16, 2026 20:35
@jimeh jimeh mentioned this pull request Nov 16, 2026
21 of 29 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automate install-guide preparation for minor release PRs

1 participant