npm-trusted-publishing

Configure GitHub Actions OIDC trusted publishing for npm packages.

121|16|Updated Oct 10, 2025
One-click install
npx skills add https://github.com/pr-pm/prpm --skill npm-trusted-publishing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: npm-trusted-publishing
Source: https://github.com/pr-pm/prpm/tree/main/.claude/skills/npm-trusted-publishing
Command: npx skills add https://github.com/pr-pm/prpm --skill npm-trusted-publishing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the security risks of using long-lived NPM_TOKEN secrets by implementing secure OIDC-based trusted publishing with provenance attestations.

Core Features & Use Cases

  • Trusted Publishing: Replace NPM_TOKEN with GitHub Actions OIDC tokens for secure authentication.
  • Provenance Attestations: Add cryptographic proof of package origin and build process.
  • Monorepo Support: Configure publishing for packages in subdirectories of monorepos.
  • Use Case: When setting up a new npm package repository, use this Skill to implement secure publishing workflows that eliminate the risk of leaked long-lived tokens.

Quick Start

Set up npm trusted publishing for a monorepo package by configuring GitHub Actions with id-token: write permissions and adding the correct repository URL in package.json.

Frequently Asked Questions about npm-trusted-publishing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I replace NPM_TOKEN with OIDC for secure npm publishing?

OIDC-based npm publishing replaces long-lived NPM_TOKEN secrets with short-lived tokens from GitHub Actions, eliminating token leak risks. Configure GitHub Actions with id-token: write permissions, set up trusted publishers in npmjs.com, and use npm publish --provenance to authenticate securely without storing credentials.

What are npm provenance attestations and why do they matter?

Provenance attestations are cryptographic records proving a package's origin and build process. They document which GitHub Actions workflow published the package, creating an auditable chain of custody that helps consumers verify package authenticity and detect tampering.

Can I use OIDC trusted publishing with monorepo packages?

Yes. Configure each package's package.json with the correct repository.url matching your GitHub repository, set the directory field for non-root packages, and configure per-package trusted-publisher settings in npmjs.com. Each monorepo package publishes independently with its own OIDC token.

What permissions and configuration do I need in GitHub Actions for npm publishing?

Set id-token: write permissions in your GitHub Actions workflow to request OIDC tokens. Ensure package.json repository.url exactly matches your GitHub repository URL, update npm version before publishing, and use npm publish --access public --provenance to enable both access and provenance.

Why should I migrate from NPM_TOKEN to trusted publishing?

Long-lived NPM_TOKEN secrets pose security risks if exposed in logs, forks, or compromised workflows. Trusted publishing uses ephemeral GitHub Actions tokens valid only for that workflow run, automatically rotating credentials and reducing the blast radius of any token compromise.

Does npm trusted publishing work with GitHub Actions workflows?

Yes, npm trusted publishing is designed specifically for GitHub Actions. It uses GitHub's OIDC provider to issue workflow-scoped tokens, eliminating the need to store npm credentials as repository secrets while maintaining full CI/CD automation.