Repository navigation
Prepare npm trusted publishing (OIDC) - #305
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The release parser drops workspace options placed before publish, causing valid npm publish commands to lose their release channel.
1 open issue
What changed in this PR
Prepares npm trusted publishing while keeping publication disabled until approved and configured.
Changes:
- Dispatches npm publishing through one workflow with the required permissions.
- Separates trusted and token authentication, disables publish scripts, and checks npm compatibility.
- Documents setup and extends release-channel detection with regression coverage.
| File | Description |
|---|---|
docs/maintainers/npm-publishing.md |
Documents trusted publishing setup and workflow design. |
dist-workspace.toml |
Grants npm workflow dispatch permission. |
.github/workflows/release.yml |
Reflects generated permission changes. |
.github/workflows/publish-npm.yml |
Adds dispatch and separate authentication paths. |
.github/projections/self-topology/releases.test.mjs |
Tests npm options before publish. |
.github/projections/self-topology/releases.mjs |
Recognizes leading npm options. |
Review effort: Balanced
agorischek
marked this pull request as ready for review
December 4, 2026 20:45
agorischek
force-pushed
the
agorischek-friendly-parakeet
branch
from
December 4, 2026 20:45
bd64501 to
c456951
Compare
2 of 4 tasks
Every npm publish now runs as publish-npm.yml: when the release calls it, it dispatches itself at the release tag, because npm's trusted publishing checks the workflow that started the run (release.yml under workflow_call). Trusted publishing sets no NODE_AUTH_TOKEN and setup-node writes no .npmrc; token publishing configures its own. Publishing uses npm --ignore-scripts publish and checks npm is 11.5.1 or later. The npm publishing guide describes the stub-first setup. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
… test Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
agorischek
force-pushed
the
agorischek-friendly-parakeet
branch
from
December 5, 2026 03:15
c456951 to
de4678c
Compare
…blish npm --workspace sdk publish, npm -w sdk publish and npm --registry <url> publish now count as npm publishes. Only options known to take a value consume the next word, so npm --silent run publish isn't one. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What changed
Prepares
@githubnext/projections-sdkfor npm trusted publishing (OIDC). Nothing turns on:NPM_PUBLISHINGstays unset and there's nonpmenvironment, so the workflow still only logs a notice. npm publishing still awaits security approval.workflow_call, that's the caller (release.yml), notpublish-npm.yml(npm docs, troubleshooting). Registering both would also be fragile: unvalidated trusted-publisher configurations expire after 48 hours (changelog), so arelease.ymlregistration could only be validated by a release within two days. So when the release callspublish-npm.yml, a newdispatchjob runsgh workflow run publish-npm.yml --ref <tag>(GITHUB_TOKEN can start workflow_dispatch runs), and thepublishjob runs only forworkflow_dispatch. Automatic and manual publishes are then bothpublish-npm.yml, the one workflow npm needs to trust. The release's call getsactions: write(dist-workspace.toml,release.ymlregenerated with dist 0.34.0).NPM_PUBLISHING=token, a missingNPM_TOKENstill fails before the already-published check, as onmain; that step sees only whether the secret is set, not the secret.setup-nodeno longer getsregistry-url, so it writes no.npmrcand exports no placeholderNODE_AUTH_TOKEN. Publishing is split into a trusted step (no token env) and a token step that alone seesNPM_TOKEN, writing a temporary userconfig that references${NODE_AUTH_TOKEN}(npm expands it; the token isn't written to disk).npm --ignore-scripts publish … --provenance.packages/sdkhas noprepack/prepublishOnly/preparescripts and the job builds it beforehand, so nothing is skipped..node-version(26.12.1) ships npm 11.20.0, so no upgrade is needed; the job now fails clearly if npm is older than 11.5.1 instead of just printing the version.npm <options> publish(including--workspace sdk,-w sdkor--workspace=sdkbeforepublish; only options known to take a value consume the next word), so the release-channel extractor still sees the npm publish once it's turned on.packages/cli/test/release.test.mjsexpects the npm post-announce job's newactions: write.docs/maintainers/npm-publishing.mddescribes the stub-first setup (placeholder publish with--access public, the publishing-access 2FA setting, thenpmenvironment, the trusted publisher's exact fields including allowing directnpm publish,NPM_PUBLISHING=trusted, then running Publish npm package within 48 hours), and why one workflow publishes.Evidence
Rebased onto
mainafter #394 renamed the package to@githubnext/projections-sdk; the workflow,dist-workspace.tomland the npm publishing guide use the new name.node --test packages/cli/test/release.test.mjs: 7 pass (after the rebase)node --test .github/projections/self-topology/releases.test.mjs: 5 pass, now covering space-separated option values (--workspace sdk,-w sdk,--registry <url>) and not readingnpm --silent -w sdk run publishas a publishnode tools/scripts/dist.mjs --check(dist 0.34.0): pass; regeneratingrelease.ymlchanges nothingnpm run format:check(oxfmt): passuses:added or changed;actions/checkoutandactions/setup-nodeare inactions.lock(gh actions-lock --verifynot run locally)Before the rebase:
npm run tools -- check --fast: passnpm run tools -- check --affected: pass (comparators aftertools build packages/comparators/runtime/js)npm run tools -- test --affected: pass (no workspace changed)node --test .github/projections/self-topology/releases.test.mjs: 5 pass, including a new case for options (and--workspace=) beforepublishnode --test packages/cli/test/release.test.mjs: 7 passnode tools/scripts/dist.mjs --check(dist 0.34.0): passactionlint1.7.12 with shellcheck onpublish-npm.yml: no findingsNot run: the workflow itself (it's inert until configured, and publishing awaits approval).
Documentation that this change affects is updated, and generated reference
pages are regenerated (
npm run docs:generate).Fixes include a regression test.
A changelog fragment at
changelog.d/<this PR's number>.mddescribes whatusers will notice, or the PR has the
no changeloglabel (seechangelog.d/README.md).
No credentials, private source or machine-specific paths are included.