Skip to content

fix: upgrade npm in publish workflow so trusted publishing works - #111

Merged
setu4993 merged 1 commit into
mainfrom
fix/npm-oidc-upgrade
Nov 14, 2026
Merged

setu4993 merged 1 commit into
mainfrom
fix/npm-oidc-upgrade

Conversation

@setu4993

Copy link
Copy Markdown
Member

Summary

  • Adds a step to the publish workflow that installs npm@11 before publishing.
  • Trusted publishing (OIDC) requires npm >= 11.5.1. Node 22 bundles npm 10.9.x, which never attempts the OIDC exchange and instead sends the placeholder NODE_AUTH_TOKEN written by setup-node. The registry rejects that with E404 Not Found - PUT (see the failed run for chore: Sync from internal → open source (2026-11-13) #110, which failed on @sf-agentscript/agentforce-dialect@2.88.3).
  • pnpm publish shells out to npm for the upload, so upgrading the global npm is sufficient.

Follow-up to #109. Note that #109's description mentions adding token: ${{ secrets.GITHUB_TOKEN }} to setup-node; that change is not in the merged workflow and is not needed. #109's run passed only because no package had a new version to publish.

Test plan

  • Each of the 15 public @sf-agentscript/* packages has a trusted publisher for salesforce/agentscript with workflow publish.yml and "Allow npm publish" enabled
  • After merge, the Publish run on main shows npm 11.x and publishes the pending versions (e.g. agentforce-dialect@2.88.3) without E404/EOTP
  • Published versions show a provenance attestation on npmjs.com

Trusted publishing (OIDC) requires npm >= 11.5.1, but Node 22 bundles npm 10.9.x, which ignores OIDC and sends the setup-node placeholder token, so publishes fail with E404.
@setu4993
setu4993 marked this pull request as ready for review November 14, 2026 00:04
@setu4993
setu4993 enabled auto-merge (squash) November 14, 2026 00:05
@setu4993
setu4993 disabled auto-merge November 14, 2026 00:13
@setu4993
setu4993 merged commit 42c06cb into main Nov 14, 2026
8 checks passed
@setu4993
setu4993 deleted the fix/npm-oidc-upgrade branch November 14, 2026 00:13
setu4993 added a commit that referenced this pull request Nov 14, 2026
)

## Summary

- `scripts/publish.mjs` now sets `repository`
(`git+https://github.com/salesforce/agentscript.git` plus the package's
`directory`) on every non-private workspace package before `pnpm -r
publish`.
- With trusted publishing working (#111), npm generates a provenance
attestation, and the registry validates `package.json` `repository.url`
against the repo in that attestation. None of the public packages
declare `repository`, so the publish for #111 failed with:
> E422 Unprocessable Entity - PUT
.../@sf-agentscript%2fagentforce-dialect - Error verifying sigstore
provenance bundle: Failed to validate repository information:
package.json: "repository.url" is "", expected to match
"https://github.com/salesforce/agentscript" from provenance
- Injected at publish time, next to the existing `@agentscript` →
`@sf-agentscript` rewrite, so the internal → open source sync can't drop
it. It also adds the repo link to the published packages on npmjs.com.

## Test plan

- [x] `node --check scripts/publish.mjs`
- [x] Read-only run of the new loop against the workspace: 15 public
packages, correct `directory` for each; private `docs`, `ui`, `vscode`
and the root are skipped
- [ ] After merge, the Publish run on main publishes the pending
versions (e.g. `agentforce-dialect@2.88.3`) without `E422`
- [ ] No `E404` on other packages (would mean that package is missing
its trusted publisher config)
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.

2 participants