Skip to content

ci: switch to npm trusted publishing (OIDC) - #194

Open
fbricon wants to merge 1 commit into
redhat-developer:mainfrom
fbricon:worktree-trusted-publisher
Open

ci: switch to npm trusted publishing (OIDC)#194
fbricon wants to merge 1 commit into
redhat-developer:mainfrom
fbricon:worktree-trusted-publisher

Conversation

@fbricon

@fbricon fbricon commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Followed instructions from https://docs.npmjs.com/trusted-publishers

  • Add id-token: write permission for OIDC-based npm auth
  • Remove NODE_AUTH_TOKEN secret from publish step
  • Install npm@^12 in release workflow (trusted publishing requires >= 11.5.1)
  • Bump Node from 20 to 22 in CI and release workflows
  • Add engines.node >= 22.14.0 to package.json
  • Update @types/node to ^22.0.0

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Updated the supported Node.js version to 22.14.0 or later.
    • Updated development tooling to align with Node.js 22.
    • Improved the release publishing workflow for more secure npm package releases.
    • Standardized CI and release jobs on Node.js 22.

Walkthrough

The project now targets Node.js 22, updates its Node.js type definitions, standardizes CI and release runtimes, and configures npm releases to use OIDC trusted publishing.

Changes

Node 22 and npm publishing

Layer / File(s) Summary
Node.js 22 runtime contract
.github/workflows/ci.yaml, package.json
CI uses Node.js 22; the package requires Node.js >=22.14.0 and uses Node.js 22 type definitions.
CI and release runtime setup
.github/workflows/ci.yaml, .github/workflows/release.yaml
The release workflow uses Node.js 22, installs npm 12, and runs on a single Ubuntu runner.
npm trusted publishing
.github/workflows/release.yaml
The workflow grants OIDC publishing permission and publishes without NODE_AUTH_TOKEN.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main change: switching npm publishing to OIDC trusted publishing.
Description check ✅ Passed The description clearly summarizes the workflow, Node, and package updates in the PR.
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.

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.

- Add id-token: write permission for OIDC-based npm auth
- Remove NODE_AUTH_TOKEN secret from publish step
- Install npm@^12 in release workflow (trusted publishing requires >= 11.5.1)
- Bump Node from 20 to 22 in CI and release workflows
- Add engines.node >= 22.14.0 to package.json
- Update @types/node to ^22.0.0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@fbricon
fbricon force-pushed the worktree-trusted-publisher branch from 066ce08 to 3439e9a Compare July 28, 2026 10:41

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/release.yaml (1)

33-34: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Pin the npm CLI version used for releases.

npm install npm@^12 -g bypasses lockfile control and can resolve different npm releases over time, making publishing behavior non-reproducible. Pin a vetted npm 12 patch version and verify its compatibility with Node.js 22.14.0.

As per path instructions: “Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yaml around lines 33 - 34, Pin the npm CLI
installation in the “Use npm 12” workflow step to a vetted, exact npm 12 patch
version compatible with Node.js 22.14.0, replacing the ^12 range so release
behavior is reproducible.

Sources: Path instructions, Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release.yaml:
- Around line 10-12: Move contents: write and id-token: write from
workflow-level permissions into a dedicated publish job that performs npm
trusted publishing and release creation. Keep build, changelog, and other
third-party action jobs least-privileged with only the permissions they require,
and ensure the publish job receives the necessary build artifacts and runs after
validation.

---

Nitpick comments:
In @.github/workflows/release.yaml:
- Around line 33-34: Pin the npm CLI installation in the “Use npm 12” workflow
step to a vetted, exact npm 12 patch version compatible with Node.js 22.14.0,
replacing the ^12 range so release behavior is reproducible.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b1701ef6-2243-4db8-80bd-df34d331187e

📥 Commits

Reviewing files that changed from the base of the PR and between 77ec405 and 3439e9a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • .github/workflows/ci.yaml
  • .github/workflows/release.yaml
  • package.json

Comment on lines +10 to +12
permissions:
contents: write # Required for creating releases
id-token: write # Required for npm trusted publishing (OIDC)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

Scope OIDC and write permissions to a dedicated publish job.

Workflow-level id-token: write and contents: write are inherited by every step, including third-party changelog and release actions. A compromised action could mint the trusted-publishing identity or modify releases. Separate publishing into a minimal job with id-token: write, leaving build and release steps least-privileged.

As per path instructions: “Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yaml around lines 10 - 12, Move contents: write
and id-token: write from workflow-level permissions into a dedicated publish job
that performs npm trusted publishing and release creation. Keep build,
changelog, and other third-party action jobs least-privileged with only the
permissions they require, and ensure the publish job receives the necessary
build artifacts and runs after validation.

Source: Path instructions

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