Skip to content

fix(ci): stop the publish job presenting a placeholder credential - #19

Merged
Bugs5382 merged 1 commit into
mainfrom
fix/oidc-auth-token
Sep 7, 2026
Merged

Bugs5382 merged 1 commit into
mainfrom
fix/oidc-auth-token

Conversation

@Bugs5382

@Bugs5382 Bugs5382 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

What and why

The v1.0.0 publish failed with ENEEDAUTH while the job environment showed:

NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX

That value is not set anywhere in this repository. actions/setup-node writes
_authToken=${NODE_AUTH_TOKEN} into the job's .npmrc whenever registry-url
is given, and exports that placeholder when nothing supplies a value. npm
therefore believed it held a credential, presented the placeholder, and failed —
rather than falling back to the OIDC exchange that trusted publishing depends
on.

The runner was not the constraint: Node 24.20.0 and npm 11.19.0, both past the
npm 11.5.1 / Node 22.14.0 trusted publishing requires.

Binding NODE_AUTH_TOKEN to the same secret the action's token input already
uses covers both states: a real token authenticates as it does for the other
packages here, and no token resolves empty, which is the condition under which
npm attempts OIDC.

This does not by itself make the first publish work. A trusted publisher is
configured per package and cannot be configured for a name that does not exist,
and staged publishing is explicit that "the package already exists on the npm
registry — you cannot stage a brand-new package". The first publish needs a
token; this change is what makes every publish after it able to go tokenless.

Closes #18

Verification

  • Lint clean
  • Tests pass
  • Build succeeds
  • Documentation updated (if behavior or API changed)

How this was verified

actionlint passes on the edited workflow. The diagnosis comes from the failed
run's own logs: the placeholder in the step environment, ENEEDAUTH from npm,
and the runner's npm version read from the setup step rather than assumed. The
tokenless path can only be confirmed once a trusted publisher exists, which
requires the package to be published first.

setup-node writes `_authToken=${NODE_AUTH_TOKEN}` into the job's .npmrc when
given a registry-url, and exports a placeholder value when nothing supplies one.
npm presented that placeholder and failed with ENEEDAUTH instead of falling back
to the OIDC exchange trusted publishing relies on, which is how the v1.0.0
publish failed.

Bind NODE_AUTH_TOKEN to the same secret the action's token input uses: a real
token authenticates as before, and no token resolves empty, which is the
condition under which npm reaches for OIDC.
@github-actions github-actions Bot added the fix label Sep 7, 2026
@Bugs5382
Bugs5382 merged commit c0033bf into main Sep 7, 2026
10 checks passed
@Bugs5382
Bugs5382 deleted the fix/oidc-auth-token branch September 7, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ci): the publish job presents a placeholder credential instead of using OIDC

1 participant