Repository navigation
ci: scope release credentials to release environments - #336
Conversation
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>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
I reviewed this PR and found no bugs. It changes how release credentials and publish rights are scoped, every changed file has a CODEOWNER, and it only works once an admin has set up the environments first, so a human look is still worthwhile.
What was reviewed:
- After this change, only
release-draft.ymlreads the two App secrets, and that job now runs in thereleaseenvironment. No other workflow on this branch reads them. - Trunk Upgrade now calls the shared workflow with no
tokeninput and noneeds. The workflow-level permissions are unchanged. - The RELEASING.md step now asks for exact-name deployment branches on both
npm-publishandrelease, which matches the environment the publish job already uses.
Extended reasoning...
This change edits two GitHub Actions workflows and RELEASING.md. It moves where the release GitHub App credentials are read from and drops an unused token-minting job. That puts it on a security-sensitive surface: which branches can get release credentials and publish. CODEOWNERS assigns all three changed files to the SDK engineering team. It also relies on repository environment settings and secret moves that an admin makes outside the diff, which this review cannot check.
jaissica12
left a comment
There was a problem hiding this comment.
PR REVIEW: #336 ci: scope release credentials to release environments
Head: 1281eb5
Verdict: Approve
Risk: low. CI and docs only, and nothing published changes. Until this merges, Release – Draft on main fails at its token step, because the repository-level credentials are already removed.
Scope: .github/workflows/release-draft.yml (+1), .github/workflows/maintenance-trunk-upgrade.yml (-18), RELEASING.md.
What it does: Runs Release – Draft in the release environment, so its GitHub App credentials come from that environment and only main and maintenance/5.x can use them. It removes the Trunk Upgrade token job, whose output was already discarded. It updates the maintenance-branch steps to add branches by exact name.
Findings:
None blocking or non-blocking.
Checked:
- Head
1281eb59: the diff, and the fullrelease-draft.yml. Addingenvironment: releasetopublish-draft-releasemakessecrets.SDK_RELEASE_GITHUB_CLIENT_IDandsecrets.SDK_RELEASE_GITHUB_APP_PRIVATE_KEYresolve from the environment. The in-workflow branch check stays as a second line. - The
releaseenvironment's deployment branches are exactlymainandmaintenance/5.x, and it holds those two secret names.npm-publishalso allows exactlymainandmaintenance/5.x. No repository-level copy of either secret remains. - Both
mainandmaintenance/5.xhave rules requiring pull requests and status checks and blocking force-pushes, so the branch-scoped environment isn't weakened by direct pushes. - The Trunk Upgrade token job:
- The 1 November scheduled run logged
Skip output 'generated-token' since it may contain secret.. - The shared
trunk-upgrade.ymlat the pinned commit takes an optionaltokenand usesinputs.token || github.tokenfor checkout and the pull request. - So removing the job changes nothing.
- The 1 November scheduled run logged
- On
mainandmaintenance/5.x, the only other readers of these secrets were these two workflows. Release – Publish already usesenvironment: npm-publish. - CI on this head passes.
Not verified:
- A successful Release – Draft run in the new environment (it would open a real release pull request).
maintenance/4.xdrafting, which the description calls out as no longer working and out of scope.
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>
Why
Release automation should hold its release powers only on the branches we release from. This change ties the credentials that open release pull requests, and the right to publish, to the main branch and to maintenance branches named one by one, instead of to the repository as a whole and to a branch-name pattern.
Programme
Standalone change, no programme.
What changes
releaseenvironment. Its GitHub App credentials come from that environment's secrets, and the environment allows onlymainandmaintenance/5.x. A run from any other branch stops before its first step. The branch check inside the workflow stays as a second line.github.token. Its behaviour is unchanged, and the pull requests it opens still do not start CI on their own, as before.npm-publishandreleaseenvironments, instead of allowingmaintenance/*.No changelog entry, because nothing in the published package changes. Left alone: the publishing workflow itself, and
maintenance/4.x, whose older workflows are a separate decision.Linked work
Depends on: the repository settings in Rollout, which were applied on 2 November 2026.
Unblocks: #337, the same workflow change on
maintenance/5.x.Rollout
Path: CI only; nothing is published. Where each step stands on 2 November 2026:
releaseenvironment allows onlymainandmaintenance/5.xand holdsSDK_RELEASE_GITHUB_CLIENT_IDandSDK_RELEASE_GITHUB_APP_PRIVATE_KEYas its secrets. Thenpm-publishenvironment now allows onlymainandmaintenance/5.x, in place ofmainandmaintenance/*.maincannot get its credentials and fails at its token step.maintenance/5.x. Merge this one before 1 December, when the monthly Trunk Upgrade runs, or that run fails at its token step too.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 and Trunk Upgrade fail at their token step.
What we watch: the next Release – Draft run on
mainand onmaintenance/5.xopens its release pull request, and the 1 December Trunk Upgrade run succeeds. A failure at the "Generate a token" step means the environment's secrets are wrong or missing.Risks
mainandmaintenance/5.xfails until this pull request and ci: scope release credentials to release environments (5.x) #337 merge, because the repository-level secrets are already removed; merging both closes it; we would see Release – Draft fail at its token step.github.token; we would see the 1 December run fail.maintenance/4.xcan no longer draft releases, because its older workflows read that key; not addressed here, as that branch's future is a separate decision; we would see Release – Draft fail on that branch.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.
Decision this implements: an engineer's request on 2 November 2026 to limit release credentials and publishing to release branches; internal, cannot be linked.
Checked: on 2 November 2026, before opening: the repository's lint checks passed on the changed files and both workflows parse, and the 1 November Trunk Upgrade run log was read. After the settings were applied: both environments' deployment branches and secret names were read through the GitHub API, and a Release – Draft run started from this branch was refused by the
releaseenvironment before its first step (run 41519367427).Not checked: a successful Release – Draft run in the new environment, which would open a real release pull request; the next release checks it.
Size
Hand-written: 4 lines added and 20 removed across 3 files.
Generated: none.
Notes for reviewers
From the 1 November scheduled Trunk Upgrade run, in the token job:
The shared workflow's
tokeninput is optional and falls back togithub.token, so the removed job had no effect.🤖 Generated with Claude Code