fix: updates release workflow to support OIDC#53
Conversation
|
WalkthroughThe change updates the GitHub Actions release workflow in 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
.github/workflows/release.yml (2)
30-30:⚠️ Potential issue | 🟡 Minor
registry-urlinsetup-nodemay inject an empty auth token that conflicts with OIDC.
actions/setup-nodeconfigured withregistry-urlwrites an.npmrcentry of the form//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}. WithNODE_AUTH_TOKENnow absent, the env-var reference resolves to an empty string at publish time. Something injecting token auth — even via environment variables or config — can cause the npm CLI to take the classic token auth path instead of OIDC.The npm CLI automatically detects OIDC environments and uses them for authentication before falling back to traditional tokens, so this may work in practice, but the stale
.npmrctoken line is unnecessary and is a latent risk. If theregistryURL is needed only for resolving the correct registry endpoint, consider moving it to the project's.npmrcfile instead of relying onsetup-node's dynamic.npmrcgeneration.♻️ Alternative: remove `registry-url` from `setup-node`
- name: Setup Node.js 22.x uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 with: node-version: 22.14.0 - registry-url: "https://registry.npmjs.org"And add a project-level
.npmrc(orpackages/react-native/.npmrc):registry=https://registry.npmjs.org/🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/release.yml at line 30, The workflow currently sets registry-url in the actions/setup-node step which causes setup-node to write an .npmrc line with //_authToken=${NODE_AUTH_TOKEN} that can inject an empty token and interfere with OIDC; remove the registry-url key from the setup-node configuration in the release workflow and instead create a project-level .npmrc containing "registry=https://registry.npmjs.org/" (or the package-specific .npmrc) so the registry is declared without causing setup-node to emit the _authToken entry.
27-30:⚠️ Potential issue | 🟠 Major
node-version: 22.xmay resolve below the minimum required for npm trusted publishing.npm trusted publishing requires npm CLI version 11.5.1 or later and Node version 22.14.0 or higher. The
22.xrange is resolved at run-time to the latest available Node 22 patch on the runner, which may or may not satisfy>=22.14.0depending on when the runner toolcache is updated. If the resolved version falls below 22.14.0, the npm CLI will not support OIDC authentication, causing the publish step to fail with an authentication error.Pin to a version known to satisfy the requirement:
🔧 Proposed fix
- node-version: 22.x + node-version: 22.14.0🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/release.yml around lines 27 - 30, The workflow currently uses actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af with node-version: 22.x which can resolve to a Node patch older than 22.14.0; update the node-version value to a pinned version that guarantees Node >=22.14.0 (for example "22.14.0" or a newer specific 22.x patch) so that actions/setup-node always installs a Node release that meets the npm trusted publishing requirement.
🧹 Nitpick comments (1)
.github/workflows/release.yml (1)
46-49: Verify that the package is registered as a trusted publisher on npmjs.com before merging.The workflow-side OIDC changes are only one half of the setup. You need to: (1) configure the trusted publisher on npmjs.com, (2) add
id-token: writepermission to your workflow, (3) removeNPM_TOKENfrom your secrets andnpm publishcommand. Steps 2 and 3 are done here; step 1 must be completed on npmjs.com.Additional operational considerations:
- For GitHub Actions, ensure
id-token: writepermission is set in your workflow. npm does not verify your trusted publisher configuration when you save it — double-check that your repository, workflow filename, and other details are correct, as errors will only appear when you attempt to publish.- Verify the workflow filename matches exactly (including
.yml) and that owner/repository are correct and case-sensitive.- Trusted publishing currently supports only cloud-hosted runners; support for self-hosted runners is intended for a future release. The
ubuntu-latestrunner used here is fine.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/release.yml around lines 46 - 49, Ensure the npm package is registered as a Trusted Publisher on npmjs.com for this repository (complete the external step on npmjs.com and verify the exact repository, owner, and workflow filename match), confirm the workflow for the release has permissions: id-token: write set (in the release.yml permissions block), remove any use of NPM_TOKEN secret and any legacy npm login steps, and keep the npm publish command in packages/react-native using OIDC (ensure the runner remains a cloud-hosted runner like ubuntu-latest).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In @.github/workflows/release.yml:
- Line 30: The workflow currently sets registry-url in the actions/setup-node
step which causes setup-node to write an .npmrc line with
//_authToken=${NODE_AUTH_TOKEN} that can inject an empty token and interfere
with OIDC; remove the registry-url key from the setup-node configuration in the
release workflow and instead create a project-level .npmrc containing
"registry=https://registry.npmjs.org/" (or the package-specific .npmrc) so the
registry is declared without causing setup-node to emit the _authToken entry.
- Around line 27-30: The workflow currently uses
actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af with node-version:
22.x which can resolve to a Node patch older than 22.14.0; update the
node-version value to a pinned version that guarantees Node >=22.14.0 (for
example "22.14.0" or a newer specific 22.x patch) so that actions/setup-node
always installs a Node release that meets the npm trusted publishing
requirement.
---
Nitpick comments:
In @.github/workflows/release.yml:
- Around line 46-49: Ensure the npm package is registered as a Trusted Publisher
on npmjs.com for this repository (complete the external step on npmjs.com and
verify the exact repository, owner, and workflow filename match), confirm the
workflow for the release has permissions: id-token: write set (in the
release.yml permissions block), remove any use of NPM_TOKEN secret and any
legacy npm login steps, and keep the npm publish command in
packages/react-native using OIDC (ensure the runner remains a cloud-hosted
runner like ubuntu-latest).



changes the workflow to support OIDC trusted publishers:
https://docs.npmjs.com/trusted-publishers