Skip to content

Conversation

@crisap94
Copy link
Member

Summary

Fixes OIDC authentication by removing registry-url from setup-node to avoid NODE_AUTH_TOKEN conflict.

Problem

Previous attempts failed because:

  1. Using pnpm publish β†’ pnpm doesn't support OIDC ❌
  2. Adding registry-url β†’ setup-node sets NODE_AUTH_TOKEN which conflicts with OIDC ❌

Root Cause

When registry-url is configured in setup-node:

  • βœ… Creates .npmrc automatically
  • ❌ Sets NODE_AUTH_TOKEN environment variable
  • ❌ npm tries token-based auth instead of OIDC
  • ❌ Token is invalid β†’ Error 404

Solution - Option 1 (Simple)

Don't use registry-url - npm CLI detects OIDC automatically:

- name: Setup Node.js
  uses: actions/setup-node@v4
  with:
    node-version: 22
    cache: 'pnpm'
    # βœ… No registry-url to avoid NODE_AUTH_TOKEN

- name: Publish to NPM
  run: npm publish --access public --tag latest --provenance
  # βœ… npm CLI uses OIDC automatically with id-token: write

How It Works

  1. GitHub Actions generates OIDC token (id-token: write permission)
  2. npm CLI detects OIDC environment automatically
  3. npm exchanges OIDC token for npm credentials
  4. Publishes with automatic provenance attestation

Changes Made

File: .github/workflows/deploy.yml

  1. Removed registry-url from setup-node (avoids NODE_AUTH_TOKEN conflict)
  2. Using npm publish instead of pnpm publish (OIDC support)
  3. Added --provenance flag (cryptographic attestation)

Configuration Summary

  • βœ… id-token: write permission
  • βœ… environment: npm-production (matches npm Trusted Publisher)
  • βœ… npm publish --provenance
  • βœ… npm CLI v11.5.1+ (auto-detected in runner)
  • ❌ NO registry-url (to avoid NODE_AUTH_TOKEN)
  • ❌ NO manual token configuration

Why This Approach

According to npm community discussions and testing:

  • Option 1 (no registry-url): Simpler, npm detects OIDC automatically
  • Option 2 (with registry-url): Requires clearing NODE_AUTH_TOKEN manually

We chose Option 1 for simplicity and fewer potential conflicts.

Verification

npm Trusted Publisher configuration verified:

  • Organization: ubidots βœ…
  • Repository: react-html-canvas βœ…
  • Workflow: deploy.yml βœ…
  • Environment: npm-production βœ…

References

@coderabbitai
Copy link

coderabbitai bot commented Dec 31, 2025

πŸ“ Walkthrough

Walkthrough

Modified the GitHub Actions deploy workflow by removing the registry-url option from the Node.js setup step and adding the --provenance flag to the npm publish command for enhanced package provenance tracking.

Changes

Cohort / File(s) Summary
GitHub Actions Configuration
.github/workflows/deploy.yml
Removed registry-url option from Node.js setup step; added --provenance flag to npm publish command for provenance data inclusion

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A workflow refined with a hop and a bound,
Registry URLs fade without a sound,
Provenance flags now shine bright and clear,
Our packages traced from far and near! ✨


πŸ“œ Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Free

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between a095b8b and 6e2ea64.

πŸ“’ Files selected for processing (1)
  • .github/workflows/deploy.yml

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

@github-actions
Copy link

πŸ” PR Quality Check Summary

Check Status
Code Quality & Tests βœ… success
Security Audit βœ… success

πŸ“‹ Checks Performed:

  • βœ… TypeScript compilation
  • βœ… ESLint code quality
  • βœ… Prettier code formatting
  • βœ… Unit tests with coverage (80%+ required)
  • βœ… Build verification
  • βœ… Security audit

πŸŽ‰ All checks passed! This PR is ready for review.

@crisap94 crisap94 merged commit bbb82d1 into main Dec 31, 2025
4 checks passed
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.

2 participants