Skip to content

ci(release): publish to npm through OIDC trusted publishing only - #54

Merged
amondnet merged 1 commit into
mainfrom
ci/npm-oidc-only
Oct 14, 2026
Merged

amondnet merged 1 commit into
mainfrom
ci/npm-oidc-only

Conversation

@amondnet

@amondnet amondnet commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The publish job ran actions/setup-node with registry-url only to write a registry .npmrc. That file reads NODE_AUTH_TOKEN, which no secret sets, so every publish ran with setup-node's placeholder token (XXXXX-XXXXX-XXXXX-XXXXX in the job env) alongside the OIDC exchange.

This PR removes that step. npm then authenticates through OIDC trusted publishing alone: id-token: write plus 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:

  • npm ^11.5.1 is still installed, as OIDC requires it.
  • --provenance stays.
  • The registry defaults to https://registry.npmjs.org, so the unauthenticated npm view checks behave the same.

Before the next release of each package, configure a trusted publisher on npmjs.com (pleaseai/code-style, workflow release-please.yml) for:

  • @pleaseai/prettier-config
  • @pleaseai/editorconfig
  • @pleaseai/ast-grep-config

@pleaseai/code-style 0.1.1 already published through OIDC with provenance in run 38536834166.

Related issue

Follow-up to #51 / #53.

Checklist

  • PR title follows Conventional Commits
  • Packages build (bun run build) — workflow-only change
  • Lint/format pass (bun run lint, actionlint)
  • Documentation updated if behavior changed
  • No breaking change, or a BREAKING CHANGE: note is included

Summary by cubic

Removes the actions/setup-node step from the release publish job so npm authenticates solely through OIDC trusted publishing. The step only wrote an .npmrc that reads NODE_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

  • Configure a trusted publisher on npmjs.com for @pleaseai/prettier-config, @pleaseai/editorconfig, and @pleaseai/ast-grep-config (workflow release-please.yml) before their next release.
  • @pleaseai/code-style 0.1.1 already published through OIDC with provenance.

Written for commit 41744cc. Summary will update on new commits.

Turn on auto-fix

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.
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying code-style with  Cloudflare Pages  Cloudflare Pages

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

View logs

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@amondnet
amondnet marked this pull request as ready for review October 14, 2026 12:09

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Loading

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Critical impact] The PR appears safe to merge with the stated trusted-publisher rollout requirement.

Summary

Removes setup-node from the publish job so it no longer creates token-based registry settings.

  • npm releases now use OIDC without a token fallback.

Reviews (1) · Last reviewed commit: "ci(release): publish to npm through OIDC..." · Reviewed by Greptile

@amondnet
amondnet merged commit f58c2c3 into main Oct 14, 2026
11 checks passed
@amondnet
amondnet deleted the ci/npm-oidc-only branch October 14, 2026 12:15
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.

1 participant