Repository navigation
Let only admins publish releases to npm - #122
Merged
Merged
Conversation
size-limit report 📦
|
Owner
Author
|
We can't let any random person or bot to hit publishing. If anyone is worried of a bus factor, you can always fork it. That's the beauty of OSS 😃 |
Merged
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.
This pull request turns the npm publishing workflow into a Release job that only repository admins can run. It targets the 4.3.0 release pull request #120, so that 4.3.0 is published with it.
✨ Features & Improvements
Releasejob. It still runs when a GitHub release is published, or manually from the Actions tab, and publishes through npm trusted publishing (OIDC) with provenance.admin. As fetchff is a personal repository, that's only @MattCCC. Collaborators with write access can still publish GitHub releases and run workflows, but the job then fails without publishing anything.contents: readandid-token: write.package.json(e.g.v4.3.0for4.3.0), and the tests must pass before the package is built and published. Only one release runs at a time.npmenvironment: the job runs in a GitHub environment namednpm, which links to the package on npm and can require an approval (see below).publish.yml, as npm's trusted publisher for fetchff is bound to that file name. No token or other setup is needed to release.🔒 Recommended Settings
The admin check runs from the workflow file of the commit being released, so someone with write access could skip it with a modified copy of the workflow on another branch. These settings, which only admins can change, close that gap:
npm(created by the first run, or added by hand): add @MattCCC as a required reviewer, and limit the deployment branches and tags tomasterandv*.npm, so that npm only accepts releases from that environment. Under Publishing access, "Require two-factor authentication and disallow tokens" also rules out publishing with tokens.🧪 Tests
admin,writeand failing API responses, and the tag check with matching and mismatching tags.actionlintreports no issues.🏷️ Releasing
Once #120 is merged, publish a GitHub release with the tag
v4.3.0onmaster. The Release job then publishes 4.3.0 to npm. If the environment requires a reviewer, approve it under "Review deployments" in the run.Generated by Claude Code