Skip to content
cccskills
FreePublished on GitHubEnglish overview

npm-trusted-publishing

Move npm releases in GitHub Actions from stored tokens to trusted publishing, which uses short-lived credentials. Check workflow permissions, tool versions, and package settings, and diagnose authentication failures or repository mismatches during publishing.

OriginalShow the original description

Set up or fix npm trusted publishing (OIDC) in GitHub Actions and remove NPM_TOKEN. Use for ENEEDAUTH, E404 on PUT, E422 repository.url, or migrating off 2FA-bypass tokens before January 2027.

github/awesome-copilot40,562 stars(GitHub 40,562 + cccskills 0)
Works withGitHub

Run score Not tested

See how to install

Good for

  • Replace stored npm publishing tokens with short-lived authentication
  • Diagnose ENEEDAUTH or E404 publishing failures
  • Fix E422 errors caused by repository.url mismatches
  • Review proposed workflow changes before applying them

Overview

What it does

This skill helps move npm package publishing from GitHub Actions away from a stored NPM_TOKEN and to trusted publishing. Trusted publishing uses OIDC, a short-lived authentication method. The skill checks workflow permissions, npm versions, environment variables, and the publisher registration on npm. It also helps diagnose ENEEDAUTH, E404 during publishing, and E422 errors involving repository.url.

When it helps

Use it when you want to remove a publishing token from a workflow or when a release fails during a migration. It can use go-tokenless to show a proposed diff and the commands needed, and explain how to apply the configuration changes.

Example requests

  • “Move this release to trusted publishing and check for any remaining token settings.”
  • “Find out why npm publishing fails with ENEEDAUTH.”

Notes

The workflow requires a GitHub-hosted runner and npm 11.5.1 or later. Registering the publisher on npm and removing the old token require the user's npm login and 2FA. A package that does not yet exist needs one manual first publish. Delete or revoke the old token only after a tokenless publish succeeds.

This overview was written by AI (OpenAI Codex) from the public SKILL.md. Check the original below for the exact behavior.

Document check

AI checked the SKILL.md for operations that need care and for setup requirements. The score comes only from actually running the skill (hands-on test).

SafetyAre sending data, deleting files, and running commands disclosed?
AGoodIt warns against unsafe triggers and delays token removal until success.
Easy setupDoes it need few tools or API keys, and are they documented?
BPartly lackingA GitHub-hosted runner, npm 11.5.1+, npm login, and 2FA are required.

Not counted in the score. Rated by AI (OpenAI Codex) as of Oct 25, 2026. Treat it as a guide and read the original before installing.

Disagree? Request a re-evaluation

Tell us which point is wrong and why. No login needed. We will check it against the SKILL.md, redo the evaluation, and show the result here.

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

Files included (1)

  • SKILL.md5.1 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

npm Trusted Publishing

Moves a GitHub Actions release from a stored NPM_TOKEN to npm trusted publishing. GitHub signs a short-lived OIDC token for the run, and npm exchanges it for a publish token. It also diagnoses the misleading errors a half-finished migration produces. From January 2027, granular tokens that bypass 2FA can no longer publish directly (npm docs).

When to Use This Skill

  • The user wants to remove NPM_TOKEN / NODE_AUTH_TOKEN from a release workflow or set up OIDC or provenance publishing.
  • A CI publish fails with ENEEDAUTH, 404 Not Found - PUT https://registry.npmjs.org/... or E422 ... repository.url.
  • Release logs show npm notice npm tokens that bypass 2FA are being restricted.

Checklist (all must hold)

Work through every item. Missing any one of them produces the errors above.

  1. OIDC permission: the publishing job has permissions: id-token: write. If the job had no permissions block, keep the scopes it needs, such as contents: write for tags and releases or pull-requests: write for changesets. Adding a block drops every scope you don't list.
  2. npm 11.5.1 or newer runs the publish. Node 24 ships it. Node 22 ships npm 10, so add npm install -g npm@^11.5.1 (or a newer pinned major) before publishing. pnpm 10 hands the publish to npm, so the same rule applies. Yarn Berry needs 4.10.3+.
  3. No token reaches the publish step. Remove NODE_AUTH_TOKEN, NPM_TOKEN and YARN_NPM_AUTH_TOKEN from the step, the job and the workflow env, and delete script lines that write _authToken or npmAuthToken. npm tries OIDC first but falls back to a configured token, so a leftover token keeps the old credential in use. Keep a read-only token only on install steps that need private packages.
  4. actions/setup-node has registry-url: https://registry.npmjs.org.
  5. package.json repository.url names the same GitHub repo, for example git+https://github.com/OWNER/REPO.git, plus directory for workspace packages. A mismatch gives E422.
  6. A trusted publisher exists on npm for each package (npmjs.com → package → Settings → Trusted publishing), or with npm 11.15+: npm trust github <pkg> --repo OWNER/REPO --file release.yml --allow-publish --yes
    • The workflow file name must match exactly; it is case-sensitive and includes .yml.
    • For a reusable workflow, use the calling workflow's file name, and grant id-token: write in the caller too.
    • If the job uses environment:, set the same environment on the publisher.
    • A package that doesn't exist yet must be published once by hand first.
  7. GitHub-hosted runner. Self-hosted runners can't use trusted publishing.

Security Rules

  • Untrusted triggers: never add id-token: write to a job in a workflow triggered by pull_request_target, issue_comment, workflow_run or discussion. It would let outsiders exchange an OIDC token and publish. Move publishing to release, push (tags) or workflow_dispatch.
  • Dry runs: npm publish --dry-run and npm pack jobs don't publish, so they need no id-token and no trusted publisher.
  • The old token: delete the secret (gh secret delete NPM_TOKEN) and revoke it on npmjs.com only after the first tokenless release succeeds.

Error Guide

ErrorUsual cause
ENEEDAUTHNo id-token: write, npm older than 11.5.1, or a workflow file name that doesn't match the trusted publisher
404 Not Found - PUT https://registry.npmjs.org/<pkg>Same as above, a mismatched environment, no trusted publisher yet, or an expired token still being used
E422 ... repository.urlrepository is missing in package.json or names another repo
Publish still uses the tokenA token remains in env, .npmrc or .yarnrc.yml (checklist item 3)

Example

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-node@v6
        with:
          node-version: 24
          registry-url: https://registry.npmjs.org
      - run: npm ci
      - run: npm publish --access public   # no NODE_AUTH_TOKEN

Automating It

go-tokenless (MIT) applies this checklist to an existing repository. Use it when the user wants the edits made for them.

  • npx go-tokenless prints a read-only diff of the workflow and package.json changes, plus the npm trust commands.
  • npx go-tokenless apply writes the changes.
  • It refuses the unsafe cases above instead of guessing.

Limitations

  • The npm side (adding the trusted publisher, deleting the old token) needs the user's npm login with 2FA. Hand those steps to the user.
  • Trusted publishing covers GitHub Actions, GitLab.com and CircleCI cloud only.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Map an existing codebase into seven documents covering its technology, structure, architecture, conventions, integrations, tests, and concerns. Link findings to file evidence, mark unknowns, and highlight differences between stated plans and the actual implementation.

  • Get oriented in an unfamiliar codebase
  • Prepare documentation for a project handover
  • Compare documented architecture with implementation
github/awesome-copilot40.6KUpdated Oct 29, 2026

Assess a repository’s readiness for AI agents with AgentRC and generate a standalone HTML dashboard. Review scores across nine areas, see prioritized improvements, and optionally apply scoring policies tailored to an organization.

  • Assessing a repository’s readiness for AI agents
  • Prioritizing improvements from assessment results
  • Reviewing scores under an organization’s own policy
github/awesome-copilot40.6KUpdated Oct 29, 2026

Generate coding agent instruction files from a project's actual code using AgentRC. Capture detected languages, frameworks, and conventions in one shared file or split rules by topic and project area, with a preview before writing.

  • Create project instructions for VS Code Copilot
  • Refresh agent rules after project changes
  • Split monorepo instructions by project area
github/awesome-copilot40.6KUpdated Oct 29, 2026

Customize AgentRC readiness assessments to match team or organization standards. Choose or create policies that adjust check importance, disable irrelevant checks, set pass thresholds, and define requirements for automated checks in CI workflows.

  • Set shared readiness standards across an organization
  • Focus assessments on AI tooling
  • Adjust the importance of individual checks
github/awesome-copilot40.6KUpdated Oct 29, 2026

Analyze supplied ad performance data to identify wasted spend, strong campaigns, and next tests. Compare channels, assess whether test differences are meaningful, and produce budget reallocation recommendations with a prioritized action plan.

  • Identify ads and keywords to pause
  • Find campaigns and audiences worth scaling
  • Assess whether A/B test results are meaningful
github/awesome-copilot40.6KUpdated Oct 29, 2026

Turn code files into learning resources by adding comments that explain syntax, programming concepts, and design choices. Adjust explanation depth and repetition to the reader’s knowledge while preserving file structure, encoding, and syntax.

  • Add beginner-friendly explanations to existing code
  • Document the reasoning behind syntax and design choices
  • Adjust comment depth for readers with different experience
github/awesome-copilot40.6KUpdated Oct 29, 2026

See all skills by github

Report a problem with this skill