ci: gate npm publish on Node.js CI success#164
Merged
Conversation
Switch the NPM Publish workflow from a direct `push` trigger to `workflow_run`, so it only runs after Node.js CI completes successfully on master. Previously both workflows ran in parallel on every master push, which meant a broken release could go live if `Node.js CI` happened to be slower than `NPM Publish`. Also pin `actions/checkout` to `github.event.workflow_run.head_sha` so we publish the exact commit that CI validated, not whatever master HEAD happens to be at trigger time. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Switches the `NPM Publish` workflow trigger from a direct `push` to `workflow_run` so it only runs after `Node.js CI` completes successfully on master.
Why
Today both workflows are triggered independently by `push: branches: [master]`, with no `needs:` relationship. They race in parallel — if `Node.js CI` happens to be slower than `NPM Publish` (which is common, since publish runs only a subset of tests via `pnpm run build`), a broken release can go live before CI flags the issue.
What changed
Caveat about workflow_run
`workflow_run` triggers always use the workflow file from the default branch, not the branch under test. This means the new behavior won't take effect until this PR is merged. Verification will have to happen on the next release after merge.
Test plan
🤖 Generated with Claude Code