Repository navigation
CHANGE @W-24708955@ Migrate npm publishing to Trusted Publishing (OIDC) - #2108
Draft
nikhil-mittal-165 wants to merge 5 commits into
Draft
nikhil-mittal-165 wants to merge 5 commits into
nikhil-mittal-165 wants to merge 5 commits into
Conversation
Replace the long-lived NPM_TOKEN with npm Trusted Publishing, ahead of the Nov 12, 2026 token expiry and npm's bypass-2fa publish deprecation. - publish-to-npm.yml: grant id-token: write, upgrade npm, pass --trusted-publishing to sf-release, drop NPM_TOKEN usage - apply-npm-tag-to-version.yml: use OIDC for dist-tag instead of a token - package.json: remove `npm shrinkwrap` (removed in npm 12) Requires the trusted publisher to be configured on npmjs.com (with "Allow npm dist-tag" enabled) before merging. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
npm 12 removed `npm shrinkwrap` and no longer packs npm-shrinkwrap.json, so `npm@latest` would silently drop the pinned dependency tree this plugin ships. - Install npm@11 (>= 11.21.0, which has OIDC dist-tag support) instead of latest - Generate the shrinkwrap with `cp package-lock.json npm-shrinkwrap.json` in prepack; verified byte-identical to `npm shrinkwrap` output and to the shrinkwrap in the published 5.16.0 tarball - Restore the /npm-shrinkwrap.json entry in `files` and its postpack cleanup Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
With npm pinned to 11, `npm shrinkwrap` still works (verified on 11.21.1: output is byte-identical to the shrinkwrap in published 5.16.0), so the `cp package-lock.json npm-shrinkwrap.json` workaround is unnecessary. package.json is now unchanged from dev. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Address SAST rule github-actions.security.run-shell-injection: move
github.event.inputs / release tag values out of direct ${{ }} interpolation
in run: steps and into env vars, quoted at use.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
Platform CLI must first configure the trusted publisher on npmjs.com (see Merge order). The title has a placeholder GUS id (
W-00000000) that must be replaced before the PR title check passes.Why
The
NPM_TOKENused to publish@salesforce/plugin-code-analyzerexpires Nov 12, 2026, and npm is ending publishes with bypass-2fa tokens in Jan 2027. Source: Platform CLI announcement in #C02JJPVHL7N (Katy Bowman) and the "Migrating to NPM trusted publishing" canvas. Reference: salesforcecli/plugin-api#228.What changed
publish-to-npm.ymlpublish-rc: addid-token: write, installnpm@11, pass--trusted-publishingtosf-release, dropNPM_TOKEN.promote-to-latest: addid-token: write, installnpm@11, drop the.npmrctoken write (npm dist-tag addnow authenticates via OIDC).verify-candidate-tag: drop the unneeded token on a read-onlynpm view.apply-npm-tag-to-version.yml: use OIDC fornpm dist-tag addinstead of a token.npm@11→ 11.21.1, which has OIDC publish + dist-tag support) instead oflatest. npm 12 removednpm shrinkwrapand no longer packsnpm-shrinkwrap.json, which this plugin ships viaprepack. On npm 11,npm shrinkwrapstill works unchanged (verified on 11.21.1: output byte-identical to the shrinkwrap in published 5.16.0), sopackage.jsonis untouched.Merge order
@salesforce/plugin-code-analyzeron npmjs.com against workflow filepublish-to-npm.yml, and a second entry forapply-npm-tag-to-version.yml. Both need "Allow npm dist-tag" enabled.Open questions for Platform CLI
sf-release npm:package:release --sign --trusted-publishingneed more thancontents: readon the GitHub token (we scoped job permissions toid-token: write+contents: read)?--sign(AWS keys) is kept alongside--trusted-publishing. I have not verified that combination end-to-end.🤖 Generated with Claude Code