fix: use OIDC trusted publishing instead of NPM_TOKEN#33
Merged
Conversation
- Remove NODE_AUTH_TOKEN/NPM_TOKEN dependency (not needed with OIDC) - Use --provenance flag directly on npm publish - Pin node-version to 24 (npm 11.5.1+ required for OIDC trusted publishing) - Requires trusted publisher configured on npmjs.com for this package
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
The publish workflow was failing with
ENEEDAUTHbecauseNPM_TOKENsecret is not configured in this repo. Instead of adding a token, this switches to npm OIDC trusted publishing which authenticates via GitHub Actions' built-in OIDC identity -- no secrets needed.Root Cause
actions/setup-nodewithregistry-urlcreates an.npmrccontaining${NODE_AUTH_TOKEN}. WhenNPM_TOKENisn't set in the repo secrets, that variable resolves to an empty string. npm then attempts token-based auth with the empty string and fails withENEEDAUTHinstead of falling through to OIDC.Changes
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}-- not needed with OIDCregistry-urlfromactions/setup-node-- prevents.npmrcfrom being generated with an empty token placeholder that blocks OIDC fallbackNPM_CONFIG_PROVENANCEenv var -- replaced with--provenanceflag directly on the publish commandnode-version: '24'-- npm CLI 11.5.1+ is required for OIDC trusted publishingid-token: writepermission was already set, which is what OIDC needsPrerequisite
The package
code-chunkmust have a trusted publisher configured on npmjs.com pointing to:supermemoryai/code-chunkrelease.ymlSee npm trusted publishing docs for setup.
Testing
24543674622) confirmingENEEDAUTHdue to emptyNODE_AUTH_TOKENregistry-urlthat generates the problematic.npmrcSession Details
(aside)to your comment to have me ignore it.