Skip to content

Trusted publishers#61

Merged
JonoPrest merged 2 commits intomainfrom
trusted-publishers
Mar 27, 2026
Merged

Trusted publishers#61
JonoPrest merged 2 commits intomainfrom
trusted-publishers

Conversation

@JasoonS
Copy link
Copy Markdown
Contributor

@JasoonS JasoonS commented Mar 27, 2026

Summary by CodeRabbit

  • Chores
    • Updated the npm publish workflow to use Node.js 24 and configured the npm registry for publishing.
    • Added repository metadata to package manifests across published builds to include the project git repository URL.

Node 22 ships with npm 10.x which doesn't support OIDC trusted
publishing (requires npm >= 11.5.1). Also add registry-url to
setup-node so npm knows which registry to authenticate against.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 256589ed-2386-40a0-b197-95c0bf63c198

📥 Commits

Reviewing files that changed from the base of the PR and between b4d5a79 and e5c8f19.

📒 Files selected for processing (6)
  • npm/darwin-arm64/package.json
  • npm/darwin-x64/package.json
  • npm/linux-arm64-gnu/package.json
  • npm/linux-x64-gnu/package.json
  • npm/linux-x64-musl/package.json
  • package.json
✅ Files skipped from review due to trivial changes (6)
  • npm/linux-x64-gnu/package.json
  • npm/linux-arm64-gnu/package.json
  • package.json
  • npm/darwin-arm64/package.json
  • npm/darwin-x64/package.json
  • npm/linux-x64-musl/package.json

📝 Walkthrough

Walkthrough

Updated the publish GitHub Actions workflow to use Node.js 24 and set the npm registry URL; added repository metadata to the root package.json and multiple platform-specific npm/*/package.json manifests.

Changes

Cohort / File(s) Summary
CI/CD Workflow
.github/workflows/publish_to_npm.yaml
Updated actions/setup-node Node version from 22 to 24 and added registry-url: https://registry.npmjs.org to the Setup node step.
Package Manifests (root + platform)
package.json, npm/darwin-arm64/package.json, npm/darwin-x64/package.json, npm/linux-arm64-gnu/package.json, npm/linux-x64-gnu/package.json, npm/linux-x64-musl/package.json
Added a top-level repository object ({ "type": "git", "url": "https://github.com/enviodev/hypersync-client-node" }) to each manifest and normalized trailing newlines. No runtime or API changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • JonoPrest

Poem

🐰 I tunneled through JSON and CI tonight,
Brought repo fields home and set Node's light.
Registry found, packages ready to roam,
A tiny hop sends the artifacts home. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title 'Trusted publishers' is vague and generic, failing to convey specific information about the changeset's actual content—adding repository metadata to package.json files and updating Node.js version in CI workflow. Use a more descriptive title that captures the main changes, such as 'Add repository metadata to package.json files for trusted publishing' or 'Configure Node.js 24 and add repository URLs for npm publishing'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch trusted-publishers

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.

@JasoonS
Copy link
Copy Markdown
Contributor Author

JasoonS commented Mar 27, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

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/publish_to_npm.yaml (1)

289-289: Minor inconsistency: Build job still uses Node.js 22.

The publish job now uses Node.js 24, but the build job (line 71) and its name (line 63: "node@22") still reference Node.js 22. This shouldn't cause functional issues since native bindings are architecture-specific rather than Node version-specific, but you may want to align them for consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/publish_to_npm.yaml at line 289, The build job still
references Node.js 22 (job name "node@22" and its node-version setting); update
that job to use node-version: 24 and rename the job label from "node@22" to
"node@24" so it matches the publish job's Node.js version for consistency
(search for the job named "node@22" and the build job's node-version field to
apply the change).
🤖 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_to_npm.yaml:
- Line 292: Update the publish step to support OIDC trusted publishers by adding
the --provenance flag to the npm publish command and removing the explicit env
authentication (remove the env: GITHUB_TOKEN block) so OIDC can authenticate
automatically; ensure the workflow still retains the registry-url:
'https://registry.npmjs.org' and the id-token: write permission but do not set
GITHUB_TOKEN for the publish step.

---

Nitpick comments:
In @.github/workflows/publish_to_npm.yaml:
- Line 289: The build job still references Node.js 22 (job name "node@22" and
its node-version setting); update that job to use node-version: 24 and rename
the job label from "node@22" to "node@24" so it matches the publish job's
Node.js version for consistency (search for the job named "node@22" and the
build job's node-version field to apply the change).
🪄 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: 5fb9fc3f-4728-46ac-ac7c-f9f3912de3b8

📥 Commits

Reviewing files that changed from the base of the PR and between beaa7a0 and b4d5a79.

📒 Files selected for processing (1)
  • .github/workflows/publish_to_npm.yaml

node-version: 24
check-latest: true
cache: yarn
registry-url: 'https://registry.npmjs.org'
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

🌐 Web query:

How to configure npm trusted publishers with GitHub Actions OIDC authentication?

💡 Result:

To configure npm trusted publishers with GitHub Actions OIDC authentication, follow these steps: 1. Ensure your package exists on npmjs.com (you cannot create new packages with OIDC; publish once manually with a token if needed). 2. Configure the trusted publisher on npmjs.com: - Go to https://www.npmjs.com/package/YOUR_PACKAGE/settings (or /access tab). - In "Trusted Publisher" section, select GitHub Actions. - Enter: - Owner: Your GitHub username or organization. - Repository: Repository name (without owner). - Workflow filename: e.g., publish.yml (must be in .github/workflows/, include .yml or .yaml extension). - Environment: Optional, e.g., 'npm' (must match workflow if used). - Save. Each package needs its own configuration; only one per package. Alternatively, use CLI (npm v11.10+): npm trust github --file publish.yml --repo owner/repo --env npm. 3. Update your GitHub Actions workflow (.github/workflows/publish.yml): name: Publish on: push: tags: ['v*'] # Or release: types: [created] permissions: id-token: write # Required for OIDC contents: read jobs: publish: runs-on: ubuntu-latest environment: npm # Optional, match npm config steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '24' # npm 11.5.1+ required; Node 24 includes it registry-url: 'https://registry.npmjs.org' - run: npm ci - run: npm run build # If needed - run: npm publish --provenance # Or set "publishConfig": {"provenance": true} in package.json - Do NOT set NODE_AUTH_TOKEN or registry-url with token; OIDC handles auth. - Use Node 24+ or install npm@latest. - Ensure package.json has "repository" field matching GitHub repo. 4. Remove any old NPM_TOKEN secrets. 5. Test by pushing a tag (e.g., git tag v1.0.1; git push --tags). Notes: - Requires npm CLI 11.5.1+ in workflow. - Automatically generates provenance attestation. - For monorepos, configure per package.

Citations:


🏁 Script executed:

# Find and view the publish_to_npm.yaml file
git ls-files | grep -i "publish.*npm"

Repository: enviodev/hypersync-client-node

Length of output: 111


🏁 Script executed:

# View the workflow file around the relevant lines
sed -n '280,320p' .github/workflows/publish_to_npm.yaml

Repository: enviodev/hypersync-client-node

Length of output: 915


🏁 Script executed:

# Check the permissions section at the top of the workflow
head -n 30 .github/workflows/publish_to_npm.yaml

Repository: enviodev/hypersync-client-node

Length of output: 687


Add --provenance flag and remove authentication env variable for OIDC trusted publishers.

The registry-url and id-token: write permission are correctly configured for OIDC, but the publish step needs two changes:

  1. Add the --provenance flag (required for npm trusted publishers with OIDC)
  2. Remove the env block—OIDC handles authentication automatically; GITHUB_TOKEN will not work with npm's registry
Required fix for npm OIDC trusted publishers
       - name: Publish
-        run: npm publish --access public
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        run: npm publish --access public --provenance
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/publish_to_npm.yaml at line 292, Update the publish step
to support OIDC trusted publishers by adding the --provenance flag to the npm
publish command and removing the explicit env authentication (remove the env:
GITHUB_TOKEN block) so OIDC can authenticate automatically; ensure the workflow
still retains the registry-url: 'https://registry.npmjs.org' and the id-token:
write permission but do not set GITHUB_TOKEN for the publish step.

Trusted publishing auto-generates provenance attestations, which
require repository.url to match the GitHub repo URL.
@JonoPrest JonoPrest merged commit 52ec69a into main Mar 27, 2026
82 of 85 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