Repository navigation
ci(release): drop registry-url to unblock OIDC npm publish - #977
Conversation
PR #976 switched the TS client publish to OIDC trusted publishing but the publish still 404'd with a "permission" error. Job log showed NODE_AUTH_TOKEN was still being injected into the publish step's env despite being removed from the workflow `env:` block. Root cause: actions/setup-node@v4 auto-exports NODE_AUTH_TOKEN whenever `registry-url` is set, sourcing the value from its `token` input which defaults to ${{ github.token }} (the workflow's auto-injected GITHUB_TOKEN). With NODE_AUTH_TOKEN present, npm CLI uses token auth and never attempts the OIDC trusted-publisher exchange — but the GITHUB_TOKEN isn't a valid npm credential, so the PUT 404s. Removing `registry-url` stops setup-node from writing .npmrc and from exporting NODE_AUTH_TOKEN. Default registry stays at npmjs.org (npm's built-in default), which is correct for the unscoped `rocketride` package. With no static token in the env and `--provenance` set, npm CLI auto-exchanges the GitHub OIDC token against the trusted publisher config on npmjs.com. Also logs `npm --version` after the explicit upgrade so future debugging can confirm npm >= 11.5.1 is actually in use.
|
Important Review skippedIgnore keyword(s) in the title. ⛔ Ignored keywords (5)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
No description provided. |
anandray
left a comment
There was a problem hiding this comment.
LGTM. Correct root cause — setup-node@v4 auto-injects NODE_AUTH_TOKEN whenever registry-url is set, which silently kept #976's OIDC switch from firing. Dropping registry-url is the minimal fix; npm defaults to registry.npmjs.org anyway for unscoped packages.
PR #976 + #977 switched to OIDC trusted publishing but the TS publish step is still failing — now with ENEEDAUTH (no auth found), which means npm 11.15 is not engaging the OIDC trusted publisher exchange even though id-token: write is set at the job level and the trusted publisher is configured on npmjs.com. This change adds diagnostic logging to surface what npm sees: - npm version (confirms >= 11.5.1) - CI / GITHUB_ACTIONS env vars - ACTIONS_ID_TOKEN_REQUEST_URL / _TOKEN presence (OIDC env vars) - NODE_AUTH_TOKEN presence (should be UNSET) - npm config get registry (which registry npm targets) - existence of .npmrc files in RUNNER_TEMP and HOME And runs npm publish with --loglevel verbose so the auth-flow internals are visible in the job log. Diagnostic-only — does not change auth setup. Once we see what npm is doing, we can fix it properly in a follow-up. Co-authored-by: Dmitrii Kataraev <dmitrii.kataraev@rocketride.ai>
Reconciles main (which had #976/#977/#978 OIDC publish fixes never back-merged to develop) with stage (= develop + version bump). Conflict resolution: take stage's content (= develop's truth) for all divergent files, EXCEPT .github/workflows/{_release,release}.yaml where main's OIDC publishing config is preserved (otherwise next release would revert to NODE_AUTH_TOKEN flow). After this merge, stage contains: today's PR set + version bump 3.2.1/1.1.1 + OIDC publish config. Ready to fire release.yaml on push to main. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Follow-up to #976. That PR enabled OIDC trusted publishing for the TS client but the publish still failed because
actions/setup-node@v4was auto-injectingNODE_AUTH_TOKENinto the publish step's env, preempting the OIDC flow.Root cause
setup-node's auth setup runs whenever
registry-urlis set. It:.npmrcwith_authToken=${NODE_AUTH_TOKEN}NODE_AUTH_TOKENto the job env, sourced from itswith.tokeninputtokeninput defaults to${{ github.token }}— the workflow's auto-injected GitHub tokenWith NODE_AUTH_TOKEN in env, npm CLI uses static-token auth (not the npm-recommended OIDC flow). The GITHUB_TOKEN isn't a valid npm credential, so the PUT returns 404 with the "permission denied" wording.
Fix
Remove
registry-urlfrom the setup-node step. Then setup-node skips auth setup entirely — no.npmrc, no NODE_AUTH_TOKEN injection. npm CLI defaults tohttps://registry.npmjs.org/(npm's built-in default for unscoped packages likerocketride) and, finding no static token + seeing--provenance, performs the OIDC trusted-publisher exchange against the config already set up on npmjs.com (reporocketride-org/rocketride-server, workflow_release.yaml, environmentrelease).Also logs
npm --versionafter the explicit upgrade so future debugging can confirm npm >= 11.5.1 is in effect.Test plan
npm: 11.x.xafter the explicit upgraderegistry.npmjs.org/rocketridesucceeds with provenance attestationNPM_TOKENrepo secret after confirmation (no longer used)