Skip to content

ci: scope release credentials to release environments (5.x) - #337

Merged
thomson-t merged 1 commit into
maintenance/5.xfrom
ci/release-environments-5.x
Nov 2, 2026
Merged

thomson-t merged 1 commit into
maintenance/5.xfrom
ci/release-environments-5.x

Conversation

@thomson-t

@thomson-t thomson-t commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Why

Release automation should hold its release powers only on the branches we release from. This brings the version 5 maintenance line in line with #336, so that the credentials that open its release pull requests come from the same restricted place as on the main branch. The repository-wide copies have been removed, so drafting on this line needs this change.

Programme

Standalone change, no programme.

What changes

The same change as #336, applied to maintenance/5.x. The three files were identical on both branches before it.

  • Release – Draft runs in the release environment. Its GitHub App credentials come from that environment's secrets, and the environment allows only main and maintenance/5.x. The branch check inside the workflow stays as a second line.
  • Maintenance – Trunk Upgrade no longer creates a GitHub App token, which Actions was already discarding because a job output that holds a secret is skipped. Its behaviour is unchanged.
  • RELEASING.md matches main: a maintenance branch is added to the npm-publish and release environments by its exact name.

No changelog entry, because nothing in the published package changes.

Linked work

Depends on: nothing still open; the repository settings it relies on were applied on 2 November 2026.
Related: #336, the same change on main, which should merge first.

Rollout

Path: CI only; nothing is published. On 2 November 2026 the release environment was set up to allow only main and maintenance/5.x, with the release credentials as its secrets, and the repository-level copies were removed. Until this pull request merges, Release – Draft on maintenance/5.x cannot get its credentials and fails at its token step.
Feature flags: none.
Turning it off: revert this pull request, which takes minutes. Because the repository-level secrets are gone, they must be added again first, or Release – Draft on this branch fails at its token step.
What we watch: the next Release – Draft run on maintenance/5.x opens its release pull request. A failure at the "Generate a token" step means the environment's secrets are wrong or missing.

Risks

  • Release – Draft on maintenance/5.x fails until this merges, because the repository-level secrets are already removed; merging this closes it; we would see Release – Draft fail at its token step on this branch.
  • The environment secrets hold a wrong value; not testable without opening a real release pull request; we would see the next Release – Draft run fail at its token step.
  • The other risks are the same as in ci: scope release credentials to release environments #336.

Risk class: low.

Who

Written by: an automated coding agent (Claude Code), at an engineer's request.
Code reviewed before opening: an independent review agent reviewed the commit on 2 November 2026 and found no blocking issues; no person has reviewed it yet.
Design reviewed before opening: no one; the design is the one in #336.
Decision this implements: an engineer's request on 2 November 2026 to apply #336 to the maintenance branch as well; internal, cannot be linked.
Checked: on 2 November 2026: the three files were compared between main and maintenance/5.x before the change and were identical, so the change applied without edits. After the settings were applied, the release environment's deployment branches (main, maintenance/5.x) and secret names were read through the GitHub API, and a run from a branch it does not allow was refused before its first step (see #336).
Not checked: a successful Release – Draft run from this branch in the new environment, which would open a real release pull request; the next 5.x release checks it.

Size

Hand-written: 4 lines added and 20 removed across 3 files, the same diff as #336.
Generated: none.

🤖 Generated with Claude Code

Backport of #336 to maintenance/5.x.

Release – Draft now runs in the `release` environment. Once the release
GitHub App credentials are stored only as that environment's secrets,
they reach only runs on the branches the environment allows.

Maintenance – Trunk Upgrade no longer mints an app token. Actions drops
a job output that contains a secret, so the token never reached the
reusable workflow, which has been running on github.token. Removing the
job keeps that behaviour: the pull requests it opens still do not start
CI on their own, as before.

RELEASING.md now says to add each maintenance branch to the npm-publish
and release environments by its exact name, not by a pattern.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@thomson-t
thomson-t marked this pull request as ready for review November 2, 2026 20:25
@thomson-t
thomson-t requested a review from a team as a code owner November 2, 2026 20:25
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T20:26:47.173428Z eb818ed Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this PR and didn't find any bugs. It changes where release credentials come from and depends on environment settings that only an admin can configure, so a human look from the code owners is still worthwhile.

What was reviewed:

  • release-draft.yml: environment: release is on the only job that reads the App secrets, and the in-workflow branch check is unchanged, so it still blocks major bumps off maintenance branches.
  • maintenance-trunk-upgrade.yml: removing the token job should not change behaviour. Actions drops job outputs that hold masked secrets, so the reusable workflow was already getting an empty token. I couldn't see that reusable workflow's default from here.
  • RELEASING.md: the exact-name guidance matches the new release environment, and the text has no internal names or links.
Extended reasoning...

The change touches two CI workflows and RELEASING.md on the maintenance branch: 1 line is added to release-draft.yml, a 15-line token-minting job is removed from the trunk-upgrade workflow, and one doc step is rewritten. The security-sensitive surface is release credentials and publishing permissions, which move from repository-level secrets to an environment restricted by deployment branch. Whether it is correct depends on repository environment settings that the diff can't show. CODEOWNERS assigns .github/workflows/ and RELEASING.md to the SDK engineering team, which is why this defers to a human.

@jaissica12 jaissica12 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR REVIEW: #337 ci: scope release credentials to release environments (5.x)
Head: eb818ed
Verdict: Approve
Risk: low. CI and docs only. Release – Draft on maintenance/5.x fails until this merges.
Scope: the same three files as #336, on maintenance/5.x.

What it does: Applies #336 to maintenance/5.x.

Findings:

None blocking or non-blocking.

Checked:

  • Head eb818ed7: the added and removed lines are identical to #336's (diffed line by line), and the three files were identical on both branches before the change.
  • maintenance/5.x's workflows read the release secrets only in these two files, and Release – Publish uses environment: npm-publish.
  • The environment setup is the same as checked on #336.
  • CI on this head passes.

Not verified:

  • A successful Release – Draft run from maintenance/5.x in the new environment.

@thomson-t
thomson-t merged commit ebfe399 into maintenance/5.x Nov 2, 2026
12 checks passed
@thomson-t
thomson-t deleted the ci/release-environments-5.x branch November 2, 2026 20:43
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.

2 participants