Let OIDC handle npm auth (drop setup-node placeholder token) - #191
Merged
Merged
Conversation
The trusted-publishing run still 404'd because setup-node's registry-url/scope
inputs make it write an .npmrc with `_authToken=${NODE_AUTH_TOKEN}` and export a
placeholder NODE_AUTH_TOKEN (XXXXXX-XXXXXX-...). npm treated that placeholder as
credentials and published with it, never attempting OIDC -- the publish notice
showed no trusted-publishing line and the PUT returned 404.
Drop registry-url/scope so no auth token is configured; npm >= 11.5.1 with
id-token then uses OIDC. The registry target comes from publishConfig.registry
in the package's package.json. Also print node/npm versions for diagnostics.
Co-Authored-By: Claude Opus 4.8 <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.
Follow-up to #189 / #190. The
npm@11pin fixed the engine error, and the run reachednpm publish— but it still 404'd, this time because OIDC never engaged.Root cause
actions/setup-node@v6withregistry-url/scopewrites an.npmrccontaining//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}and exports a placeholderNODE_AUTH_TOKEN(XXXXXX-XXXXXX-XXXXXX-XXXXXX) to every step. npm resolved that placeholder as credentials, published with it, and skipped OIDC entirely — the log showed:No trusted-publishing/OIDC notice, i.e. npm used a token, not OIDC.
Fix
Remove
registry-url/scopefromsetup-nodeso no_authToken(and no placeholder) is configured. With npm >= 11.5.1 andid-token: write, npm then performs the OIDC token exchange. The publish registry still comes frompublishConfig.registryinsrc/Resources/CrestApps.AI.Resources/package.json. Also printnode/npmversions for diagnostics.Verify after merge
Trigger
Publish npm(workflow_dispatch). Expect an OIDC/trusted-publishing notice and a successful publish of the next2.0.0-preview.Nto thepreviewtag.🤖 Generated with Claude Code