Skip to content

Align npm trusted publishing workflow - #6

Merged
oleg-kuibar merged 1 commit into
masterfrom
codex/npm-trusted-publishing
Apr 27, 2026
Merged

Align npm trusted publishing workflow#6
oleg-kuibar merged 1 commit into
masterfrom
codex/npm-trusted-publishing

Conversation

@oleg-kuibar

@oleg-kuibar oleg-kuibar commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Bind the publish workflow to npm trusted publishing expectations with npm registry setup
  • Remove the redundant --provenance flag because npm generates provenance automatically for trusted publishing from public GitHub Actions
  • Update pnpm setup actions in CI and publish workflows to v6 and pin the repo to pnpm 10.33.2
  • Fix release-readiness fixtures: build example packages with their committed npm lockfiles, add DOM fetch types to the API client fixture, and remove the stale unpublished knarr@0.2.0 dependency from the Bun standalone example

Verification

  • Parsed .github/workflows/publish.yml with js-yaml
  • Parsed .github/workflows/ci.yml with js-yaml
  • Built examples/packages/api-client with npm ci && npx tsup
  • Built examples/packages/ui-kit with npm ci && npx tsup
  • Ran pnpm install --frozen-lockfile
  • Ran pnpm lint
  • Ran pnpm build
  • Ran pnpm test

@coderabbitai

coderabbitai Bot commented Apr 27, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

GitHub Actions workflows are upgraded: pnpm/action-setup moves from v5 to v6 in both CI and publish pipelines. The publish workflow additionally upgrades actions/setup-node to v6, adds an explicit npm registry URL, and removes the --provenance flag from the npm publish command.

Changes

Cohort / File(s) Summary
CI Workflow
.github/workflows/ci.yml
Upgraded pnpm/action-setup action from v5 to v6.
Publish Workflow
.github/workflows/publish.yml
Upgraded pnpm/action-setup to v6 and actions/setup-node to v6 with explicit npm registry URL configuration. Removed --provenance flag from npm publish command, with inline comment noting reliance on trusted/OIDC behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 With pnpm and actions upgraded with care,
v6 workflows hop through the GitHub air,
Provenance goes, OIDC stays true,
Registry configured, the publish runs through! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Align npm trusted publishing workflow' accurately captures the main objective of the PR, which updates workflow configurations for npm trusted publishing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description follows the required template with complete Summary and Verification sections, clearly explaining the changes and testing performed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/npm-trusted-publishing

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/publish.yml:
- Around line 47-51: The Publish step that runs "npm publish --access public"
may use an older bundled npm because node-version: 24 is unpinned; to ensure
trusted publishing, update the workflow to either (A) install a sufficiently new
npm immediately before publishing by adding an installation step that runs "npm
install -g npm@latest" (or npm@11.5.1+) prior to the Publish step, or (B) pin
the runner Node to a specific 24.x that bundles npm ≥ 11.5.1 (e.g., change the
node-version to 24.5.0) so that the "Publish" step always has npm ≥ 11.5.1 when
executing "npm publish --access public".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 772ef2bd-6bb9-467d-a124-f491871baad8

📥 Commits

Reviewing files that changed from the base of the PR and between 025759c and d8824cf.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • .github/workflows/publish.yml

Comment on lines 47 to +51
- name: Publish
if: inputs.dry_run == false
run: npm publish --provenance --access public
# Trusted publishing uses OIDC; npm adds provenance automatically for
# public packages published from public GitHub repositories.
run: npm publish --access public

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/publish.yml

Repository: oleg-kuibar/knarr

Length of output: 1603


🏁 Script executed:

# Find and examine package.json to check repository configuration
fd -t f package.json | head -5 | xargs cat -n

Repository: oleg-kuibar/knarr

Length of output: 2936


🏁 Script executed:

# Check if there's an existing npm upgrade step in the workflow
rg "npm.*install.*-g" .github/workflows/

Repository: oleg-kuibar/knarr

Length of output: 43


🌐 Web query:

npm CLI trusted publishing OIDC requirements minimum version

💡 Result:

The minimum npm CLI version required for trusted publishing with OIDC is 11.5.1. It also requires Node.js version 22.14.0 or higher.

Citations:


🌐 Web query:

Node.js 24.0.0 bundled npm version

💡 Result:

Node.js 24.0.0 bundles npm version 11.0.0.

Citations:


🏁 Script executed:

# Find root package.json
rg "\"repository\"" . -A 2 -B 2 --type json | head -30

Repository: oleg-kuibar/knarr

Length of output: 256


🏁 Script executed:

# Look for root package.json specifically in root directory
cat -n package.json 2>/dev/null | head -100

Repository: oleg-kuibar/knarr

Length of output: 2892


🌐 Web query:

Node.js 24.3.0 24.5.0 bundled npm version

💡 Result:

Node.js 24.3.0 bundles npm 11.4.2. Node.js 24.5.0 bundles npm 11.5.1. These versions are specified in the official Node.js release announcements. For Node.js 24.3.0 (released 2025-06-24), the commit [68671f4314] upgrades npm to 11.4.2 (#58696). For Node.js 24.5.0 (released 2025-07-31), the commit [55a90eed8d] upgrades npm to 11.5.1 (#59199). Node.js 24 entered the series with npm 11.0.0, and subsequent releases include npm upgrades as listed in their respective release notes.

Citations:


🌐 Web query:

Node.js 24 latest version bundled npm version

💡 Result:

The latest version of Node.js 24 is v24.15.0 (LTS 'Krypton'), released on 2026-04-15. It bundles npm version 11.12.1.

Citations:


Ensure npm ≥ 11.5.1 for trusted publishing — node-version: 24 alone does not guarantee it.

Trusted publishing requires npm ≥ 11.5.1 (and Node ≥ 22.14.0). The workflow uses node-version: 24 without a minor version, which resolves to any cached Node 24.x on the runner. Node 24.0.0 through 24.4.x bundle npm < 11.5.1 (e.g., 24.0.0 → npm 11.0.0; 24.3.0 → npm 11.4.2). If the runner resolves to one of these versions, the OIDC token exchange will fail, causing the publish to error with 401/403, or worse—silently fall back to a saved token, defeating provenance altogether.

The auto-provenance comment is correct: npm skips --provenance and auto-attests provenance for public packages from public GitHub repos under trusted publishing.

Mitigate by either:

  • Adding npm install -g npm@latest before the publish step, or
  • Pinning to a specific Node 24.x known to bundle npm ≥ 11.5.1 (e.g., node-version: 24.5.0 or newer).
Suggested fix: upgrade npm before publishing
       - run: pnpm test
       - run: npm pack --dry-run
 
+      - name: Ensure npm >= 11.5.1 for trusted publishing
+        if: inputs.dry_run == false
+        run: |
+          npm install -g npm@latest
+          npm --version
+
       - name: Publish
         if: inputs.dry_run == false
         # Trusted publishing uses OIDC; npm adds provenance automatically for
         # public packages published from public GitHub repositories.
         run: npm publish --access public
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/publish.yml around lines 47 - 51, The Publish step that
runs "npm publish --access public" may use an older bundled npm because
node-version: 24 is unpinned; to ensure trusted publishing, update the workflow
to either (A) install a sufficiently new npm immediately before publishing by
adding an installation step that runs "npm install -g npm@latest" (or
npm@11.5.1+) prior to the Publish step, or (B) pin the runner Node to a specific
24.x that bundles npm ≥ 11.5.1 (e.g., change the node-version to 24.5.0) so that
the "Publish" step always has npm ≥ 11.5.1 when executing "npm publish --access
public".

@oleg-kuibar
oleg-kuibar force-pushed the codex/npm-trusted-publishing branch 3 times, most recently from c3c17c1 to 76a8249 Compare April 27, 2026 07:11
@oleg-kuibar
oleg-kuibar force-pushed the codex/npm-trusted-publishing branch from 76a8249 to 5546e5d Compare April 27, 2026 07:15
@oleg-kuibar
oleg-kuibar merged commit 21c5a1d into master Apr 27, 2026
10 checks passed
@oleg-kuibar
oleg-kuibar deleted the codex/npm-trusted-publishing branch April 27, 2026 17:46
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