ci: require reviewer approval on the production release environment - #92
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 075f08ff60
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| ### Recovery from an interrupted publish | ||
|
|
||
| `changeset publish` (`ci:publish`) is safe to re-run: it walks each workspace package, compares its `package.json` version against what's already on npm, and only publishes versions that aren't there yet. If the `release` job fails or is cancelled partway through a multi-package publish (e.g. network blip after package A publishes but before package B does), simply re-running the workflow (re-push, or `gh workflow run publish.yml` / re-approve the environment) picks up where it left off - already-published versions are skipped, not re-published or errored on. |
There was a problem hiding this comment.
Use a supported command to rerun the publish workflow
When recovering from a failed publish, gh workflow run publish.yml cannot trigger this workflow: I checked .github/workflows/publish.yml, and it declares only on.push, while gh workflow run --help states that the workflow must support an on.workflow_dispatch trigger. Use gh run rerun <run-id> to rerun the existing exact-SHA run, or add workflow_dispatch before documenting this command; otherwise the documented recovery path fails immediately.
AGENTS.md reference: AGENTS.md:L417-L417
Useful? React with 👍 / 👎.
Intent
publish.yml'sreleasejob wait on the full CI suite (needs: validate) for the exact SHA before it can enter theproductionenvironment. This closes the remaining gap from that story: verify theproductionenvironment actually requires reviewer approval, and make sure that approval is structurally after the CI gate, not a separate/racing check.productionto require reviewer approval (viaPUT /repos/.../environments/production) - previously it hadenvironment: productionreferenced in the workflow but no protection rules at all, so the job would run unattended the momentvalidatepassed.releasejob'senvironment: productionblock only starts onceneeds: validatehas completed, so the reviewer is approving a run that has already passed CI for that exact commit, not a racing/unrelated one.can_admins_bypassenvironment setting lets a repo admin skip protection entirely, and isn't configurable per-environment via this API (it requires org rulesets, not available here) - documented as a known limitation inRELEASE.mdrather than silently left unaddressed.RELEASE.md, which still described a manualgit tagrelease flow that hasn't matchedpublish.ymlfor a while, to document the actual changesets/action-driven flow plus recovery/idempotency for an interrupted publish (changeset publishre-run behavior, what state is/isn't preserved on failure at each stage).No changes to the publish mechanics themselves - Changesets and npm OIDC trusted publishing are untouched.
Test plan
gh api repos/Teslemetry/typescript-teslemetry/environments/productionthat the required-reviewer protection rule is now presentRELEASE.md, no build/test impact