Repository navigation
ci(release): publish to npm through OIDC trusted publishing only - #54
Merged
Merged
Conversation
Drop the actions/setup-node step from the publish job. It only wrote an .npmrc that reads NODE_AUTH_TOKEN, which nothing sets, so npm saw a placeholder token next to the OIDC exchange. npm now authenticates with id-token: write and each package's trusted publisher alone, and a package without one fails instead of falling back to a token.
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
Deploying code-style with
|
| Latest commit: |
41744cc
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b01c23b0.code-style.pages.dev |
| Branch Preview URL: | https://ci-npm-oidc-only.code-style.pages.dev |
Up to standards ✅🟢 Issues
|
amondnet
marked this pull request as ready for review
October 14, 2026 12:09
There was a problem hiding this comment.
No issues found across 1 file
Architecture diagram
sequenceDiagram
participant GA as GitHub Actions
participant RP as Release Please
participant Mise as mise-action
participant NPM as npm CLI
participant OIDC as GitHub OIDC Provider
participant NPMReg as registry.npmjs.org
Note over GA,NPMReg: Release Publish Job - OIDC only
GA->>GA: Checkout code
GA->>GA: id-token: write permission
GA->>Mise: Install toolchain (node.js)
Mise-->>GA: node on PATH
GA->>NPM: Install npm ^11.5.1
Note over NPM: OIDC requires npm >= 11.5.1
GA->>NPM: Run publish
alt Trusted publisher configured (e.g. @pleaseai/code-style)
NPM->>OIDC: Request OIDC token (id-token: write)
OIDC-->>NPM: JWT with workflow identity + package name
NPM->>NPMReg: npm publish --provenance
Note over NPMReg: OIDC exchange validates trusted publisher
NPMReg-->>NPM: 201 + provenance receipt
NPM-->>GA: Success
else No trusted publisher (e.g. @pleaseai/prettier-config)
NPM->>OIDC: Request OIDC token
OIDC-->>NPM: JWT with workflow identity
NPM->>NPMReg: npm publish --provenance
Note over NPMReg: No matching trusted publisher
NPMReg-->>NPM: 401 Unauthorized
NPM-->>GA: Fail (no NODE_AUTH_TOKEN fallback)
end
|
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.
Summary
The publish job ran
actions/setup-nodewithregistry-urlonly to write a registry.npmrc. That file readsNODE_AUTH_TOKEN, which no secret sets, so every publish ran with setup-node's placeholder token (XXXXX-XXXXX-XXXXX-XXXXXin the job env) alongside the OIDC exchange.This PR removes that step. npm then authenticates through OIDC trusted publishing alone:
id-token: writeplus a trusted publisher configured on npmjs.com for each package. A package with no trusted publisher now fails to publish instead of falling back to a token.Unchanged:
^11.5.1is still installed, as OIDC requires it.--provenancestays.https://registry.npmjs.org, so the unauthenticatednpm viewchecks behave the same.Before the next release of each package, configure a trusted publisher on npmjs.com (
pleaseai/code-style, workflowrelease-please.yml) for:@pleaseai/prettier-config@pleaseai/editorconfig@pleaseai/ast-grep-config@pleaseai/code-style0.1.1 already published through OIDC with provenance in run 38536834166.Related issue
Follow-up to #51 / #53.
Checklist
bun run build) — workflow-only changebun run lint,actionlint)BREAKING CHANGE:note is includedSummary by cubic
Removes the
actions/setup-nodestep from the release publish job so npm authenticates solely through OIDC trusted publishing. The step only wrote an.npmrcthat readsNODE_AUTH_TOKEN, which no secret sets, so npm was running with setup-node's placeholder token and a package without a trusted publisher silently fell back to it instead of failing.Rollout
@pleaseai/prettier-config,@pleaseai/editorconfig, and@pleaseai/ast-grep-config(workflowrelease-please.yml) before their next release.@pleaseai/code-style0.1.1 already published through OIDC with provenance.Written for commit 41744cc. Summary will update on new commits.