Skip to content

release.yml: restore --provenance flag + add OIDC diagnostics#34

Merged
joaoh82 merged 1 commit intomainfrom
fix/nodejs-oidc-provenance-flag
Apr 25, 2026
Merged

release.yml: restore --provenance flag + add OIDC diagnostics#34
joaoh82 merged 1 commit intomainfrom
fix/nodejs-oidc-provenance-flag

Conversation

@joaoh82
Copy link
Copy Markdown
Owner

@joaoh82 joaoh82 commented Apr 25, 2026

What broke (again)

The v0.1.6 canary's publish-nodejs failed with a different error than v0.1.5:

npm 11.13.0
npm error code ENEEDAUTH
npm error need auth This command requires you to be logged in to https://registry.npmjs.org/

Progress vs. v0.1.5: npm 11.13 was correctly used (so the npm install -g npm@latest step works), and the previous NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX red herring is gone (so dropping registry-url worked). But npm CLI didn't even try OIDC — it just looked for a configured _authToken, found none, and gave up.

Diagnosis

I had removed the --provenance flag in PR #32 based on npm's docs claiming "trusted publishers auto-detect, no flags needed". Empirically, that's wrong — --provenance is what tells npm CLI to use the OIDC code path. Without it, npm only checks token-based auth and bails with ENEEDAUTH.

Other npm-OIDC-publishing projects (Prettier, ESLint, …) all use --provenance explicitly. I should have copied them, not the docs.

What changes

Before (v0.1.6) After
npm publish --access public npm publish --access public --provenance --loglevel verbose
(no diagnostics) New step prints whether ACTIONS_ID_TOKEN_REQUEST_URL + ACTIONS_ID_TOKEN_REQUEST_TOKEN are set
Comment claimed --provenance was redundant Comment now captures the combined truth: drop registry-url AND keep --provenance — both required, neither alone works

--loglevel verbose is cheap insurance: if there's a third bug hiding behind this one, the next failure log will have enough detail to diagnose without re-running.

v0.1.6 wave status

Same partial-state as v0.1.5: 4 of 5 packages shipped, npm one missing. After this PR merges I'll cut v0.1.7. The previous failed npm tag (sqlrite-node-v0.1.6) and missing umbrella (v0.1.6) stay as they are per never-reuse-a-version policy.

Test plan

  • python3 -c "import yaml; yaml.safe_load(open('.github/workflows/release.yml'))" — YAML parses
  • CI on this PR
  • After merge: dispatch v0.1.7. Watch for:
    • ACTIONS_ID_TOKEN_REQUEST_URL is set: yes in the diagnostics step (confirms GHA injected the OIDC env)
    • npm publish succeeds → @joaoh82/sqlrite@0.1.7 on npm
    • npm view @joaoh82/sqlrite shows the new version
    • npm audit signatures passes against the sigstore attestation

If publish-nodejs fails again, the verbose npm log will show exactly what npm tried (token vs OIDC) and where it failed.

🤖 Generated with Claude Code

Second iteration of the publish-nodejs fix. The previous PR
(#32) cleared the wrong-thing-blocking-OIDC issue
(setup-node's registry-url generating an .npmrc that forced
token auth), but went too far by also removing the
`--provenance` flag based on docs that claim "no flags needed
for trusted publishers".

The v0.1.6 canary failed with:

  npm error code ENEEDAUTH
  npm error need auth This command requires you to be logged in
  to https://registry.npmjs.org/

ENEEDAUTH means npm CLI didn't even *try* OIDC token
exchange — it just looked for a configured _authToken, found
none, and gave up. Empirically, npm 11.5+ trusted publishing
*does* require `--provenance` to trigger the OIDC code path,
even though the official docs claim auto-detection.

Fix:
  - Restore `npm publish --provenance --access public`
  - Add `--loglevel verbose` so future auth/transport errors
    print enough detail to diagnose without re-running with
    debug logging on
  - Add a diagnostics step that prints whether
    ACTIONS_ID_TOKEN_REQUEST_URL +
    ACTIONS_ID_TOKEN_REQUEST_TOKEN are set (these are the
    GHA-injected env vars that OIDC depends on; if either is
    missing, OIDC can't possibly work and we want to see that
    in the log)
  - Updated the long inline comment block on the publish step
    to capture the *combined* understanding from PR #32 + this
    PR: registry-url removal + --provenance restoration are
    BOTH required, neither alone works

After this merges I'll dispatch v0.1.7 (v0.1.6 wave already
shipped 4 of 5 channels; the npm slot stays empty). The
diagnostic step will confirm OIDC env vars are present
regardless of whether publish succeeds or fails.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@joaoh82 joaoh82 merged commit b7f2f2a into main Apr 25, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant