Skip to content

Commit bf7db27

Browse files
committed
ci: stop setup-node writing a token that preempts the OIDC exchange
`registry-url` makes setup-node write `_authToken=${NODE_AUTH_TOKEN}` to the job's npmrc. Nothing sets that variable now, so npm read a credential, treated auth as configured, skipped the exchange and sent the placeholder: "Unable to authenticate, your authentication token seems to be invalid" (actions/setup-node#1551). registry.npmjs.org is the default, so dropping the input changes nothing else. A token reaching the npmrc again fails the job naming the file, rather than reappearing as a 401 from the registry. The dist-tag failure now says a configuration has to name this workflow file: they are keyed on the filename and grant dist-tag per configuration, so the one covering publish.yaml authorizes nothing here. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Y4EZAEvxLfXuMeNz5ZgCMz
1 parent 1f2a12f commit bf7db27

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

‎.github/workflows/promote.yaml‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v4
2323

24+
# No `registry-url`: it makes setup-node write an `_authToken` line to the
25+
# job's npmrc, and with no NODE_AUTH_TOKEN to expand it npm reads a
26+
# credential, treats auth as configured and never runs the OIDC exchange
27+
# (actions/setup-node#1551). registry.npmjs.org is npm's default anyway.
2428
- uses: actions/setup-node@v4
2529
with:
2630
node-version: "24.x"
27-
registry-url: "https://registry.npmjs.org"
2831

2932
# The runner's bundled npm predates OIDC support for dist-tag, which
3033
# npm/cli#10038 added in 11.21.0 and 12.2.0. Pinned rather than `latest`:
@@ -34,10 +37,18 @@ jobs:
3437
- name: Install npm with OIDC dist-tag support
3538
run: npm install -g [email protected] --ignore-scripts
3639

40+
- name: Check nothing shadows the OIDC exchange
41+
run: |
42+
rc="${NPM_CONFIG_USERCONFIG:-$HOME/.npmrc}"
43+
if [ -f "$rc" ] && grep -q '_authToken' "$rc"; then
44+
echo "::error::$rc configures an auth token, so npm will skip the OIDC exchange and send that token instead. Drop whatever wrote it (usually setup-node's registry-url)."
45+
exit 1
46+
fi
47+
3748
- name: Promote to latest
3849
run: |
3950
if ! npm dist-tag add @currents/mcp@${{ github.event.inputs.packageVersion }} latest; then
40-
echo "::error::The registry refused the dist-tag. Trusted publishing grants it separately from publish, and it is off by default: enable 'Allow npm dist-tag' on the trusted publisher configuration for @currents/mcp at https://www.npmjs.com/package/@currents/mcp/access"
51+
echo "::error::The registry refused the dist-tag. Trusted publishing configurations are keyed on the workflow filename and each grants dist-tag separately, so @currents/mcp needs a configuration naming THIS file with 'Allow npm dist-tag' enabled on it — the one for publish.yaml does not carry over. https://www.npmjs.com/package/@currents/mcp/access"
4152
exit 1
4253
fi
4354
npm dist-tag rm @currents/mcp beta

0 commit comments

Comments
 (0)