ci: publish only when the commit is already on master - #396
Merged
Merged
Conversation
npm publish follows the tag, so an open release PR could ship before it was merged. Fail the workflow first unless HEAD is contained in master. Co-authored-by: Perry <plrthink@gmail.com>
The publish job now depends on both gates, so the old needs: zip-interop assertion no longer matches the workflow. Co-authored-by: Perry <plrthink@gmail.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
There is no marketplace action that means “this tag is already on
master.” npm publish in this repo follows the tag, which is why 9.5.2 shipped while #395 was still open.This adds our own check as the first job in
publish.yml. It fetchesorigin/masterand refuses to continue unlessHEADis already on that branch. A tag on an open pull request fails before the interop job and beforenpm publish. Manual dispatch is covered by the same check.7.x is unchanged. Its tags still run the workflow file on the
7.xcommit.After this merges, the release order is: merge the version bump, then tag that merge commit.
Test plan
jest __tests__/require-commit-on-master.test.js— accepts a commit onmaster, rejects a commit that exists only on a branch, accepts it again after a fast-forward merge