Skip to content

Commit 362aaf7

Browse files
committed
fix(ci): configure pnpm npm registry auth before publish
pnpm 11's native publish no longer inherits auth from the NPM_TOKEN env var the way pnpm 10's npm-CLI-shelling publish did, and pnpm 10.34.2+/11.5.3+ also stopped expanding ${VAR} placeholders from a repo's .npmrc (GHSA-3qhv-2rgh-x77r). Explicitly run `pnpm config set` before the changesets/action publish step, matching the pattern already used in .github/actions/changeset-snapshot/action.yml.
1 parent c8008e3 commit 362aaf7

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ jobs:
5050
- name: Setup node and install deps
5151
uses: ./.github/actions/node-setup
5252

53+
# pnpm 11 stopped expanding ${NPM_TOKEN}-style placeholders from a repo's
54+
# .npmrc (GHSA-3qhv-2rgh-x77r), so auth has to be written via `pnpm config
55+
# set` at runtime instead of relying on env-var substitution in .npmrc.
56+
- name: Configure npm registry auth
57+
shell: bash
58+
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
59+
env:
60+
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
61+
5362
# Process changesets: create version PR or publish packages to npm
5463
# This step requires write permissions to create releases and publish packages
5564
- name: Create Release Pull Request or Publish to npm

.github/workflows/next.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ jobs:
6464
- name: Setup node and install deps
6565
uses: ./.github/actions/node-setup
6666

67+
# pnpm 11 stopped expanding ${NPM_TOKEN}-style placeholders from a repo's
68+
# .npmrc (GHSA-3qhv-2rgh-x77r), so auth has to be written via `pnpm config
69+
# set` at runtime instead of relying on env-var substitution in .npmrc.
70+
- name: Configure npm registry auth
71+
shell: bash
72+
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
73+
env:
74+
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
75+
6776
- name: Create Release Pull Request or Publish to npm
6877
id: changesets
6978
uses: changesets/action@v2

0 commit comments

Comments
 (0)