本文へ移動
cccskills
無料GitHub で公開日本語紹介

npm-trusted-publishing

GitHub Actionsからのnpm公開を、保存済みトークンから短期認証へ移行するスキル。必要な設定を点検し、認証エラーや公開時の不整合を診断します。

原文原文の説明を見る

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-copilotスター 40,567(GitHub 40,567 + cccskills 0)
連携ツールGitHub

実行スコア 未検証

インストール方法を見る

こんなときに便利

  • npm公開用の保存トークンを置き換える
  • ENEEDAUTHやE404を調べたいとき
  • repository.urlのE422を修正
  • 設定変更の差分を適用前に確認

日本語での紹介

できること

GitHub Actionsからnpmパッケージを公開する仕組みを、保存したNPM_TOKENからtrusted publishingへ移行するスキルです。OIDCという短期認証の仕組みを使うために、権限、npmのバージョン、環境変数、公開元の登録情報を点検します。ENEEDAUTH、公開時のE404、repository.urlに関するE422の原因も切り分けます。

こんなときに便利

公開用トークンをワークフローから外したい人や、移行途中で公開が失敗している開発者に向いています。go-tokenlessで変更案の差分と必要なコマンドを確認し、設定変更を適用する方法も案内します。

使い方の例

「このリリースをtrusted publishingに移行し、残っているトークン設定を確認して」 「npm公開がENEEDAUTHで失敗する原因を調べて」

注意点

この手順ではGitHub-hosted runnerとnpm 11.5.1以降が必要です。npm側の登録や旧トークンの削除には、利用者のnpmログインと2FAが必要です。未作成のパッケージは初回の手動公開が必要で、旧トークンはトークンなしの公開成功後に削除・失効させます。

この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。

資料チェック

SKILL.md の記述から、注意が要る操作と導入の前提を AI が確認しました。点数は実際に動かした結果(実行検証)だけで付けています。

安全面送信・削除・コマンド実行などの扱いが明示されているか
A良好危険なトリガーを避け、トークン削除は成功後と明記されています。
導入のしやすさ必要なツールや API キーが少ないか、書かれているか
B一部不足GitHub-hosted runner、npm 11.5.1以上、npmログインと2FAが必要です。

点数には入れていません。 2026年10月25日 時点で AI(OpenAI Codex)が判定しました。目安なので、入れる前に原文も確認してください。

評価が違うと思ったら、見直しを依頼する

どの項目が、なぜ違うと思うかを書いてください。ログインは不要です。内容を SKILL.md と照らし合わせて評価を作り直し、この欄に反映します。

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

含まれるファイル(1)

  • SKILL.md5.1 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

acquire-codebase-knowledge

無料概要あり

既存プロジェクトのコードや設定を調べ、技術構成・設計・規約・テスト・懸念点などを7つの文書に整理します。根拠のファイルと不明点も明記し、引き継ぎに役立てます。

  • 初めて触るコードの全体像を知りたいとき
  • プロジェクトの引き継ぎ資料作成
  • 設計資料と実装の違いを確認
github/awesome-copilot4.1万2026年10月29日 更新

acreadiness-assess

無料概要あり

リポジトリのAI活用準備度をAgentRCで評価し、9つの観点のスコアや改善案をHTMLにまとめます。組織独自の採点方針にも対応します。

  • AIエージェント導入前の準備度確認
  • 評価結果から改善の優先順位を決めたいとき
  • 組織独自の基準で採点したいとき
github/awesome-copilot4.1万2026年10月29日 更新

実際のコードから言語や開発ルールを読み取り、AIコーディングエージェント向けの指示ファイルを生成。プロジェクト全体や領域別にルールを整理します。

  • VS Code Copilot向け指示を作成
  • 開発ルールの変更を指示に反映
  • モノレポの領域別ルールを整理
github/awesome-copilot4.1万2026年10月29日 更新

acreadiness-policy

無料概要あり

AgentRCの準備度評価を、組織やチームの基準に合わせて調整します。チェックの重みや合格率、除外項目を設定し、CIでの合否判定にも使えます。

  • 組織共通の評価基準づくり
  • AI関連の整備状況だけを評価
  • チェックの重要度を調整したいとき
github/awesome-copilot4.1万2026年10月29日 更新

ad-campaign-analyzer

無料概要あり

広告の実績データから無駄な支出と成果の高い施策を見つけ、停止・増額・検証の候補を整理します。媒体をまたぐ予算配分の見直しやA/Bテストの評価にも使えます。

  • 停止すべき広告やキーワードの特定
  • 増額候補のキャンペーンや配信対象の発見
  • A/Bテスト結果の有意性を確認したいとき
github/awesome-copilot4.1万2026年10月29日 更新

add-educational-comments

無料概要あり

指定したコードファイルに、構文や設計の理由を説明する学習用コメントを追加します。読む人の知識に合わせて解説の深さや繰り返し、注釈番号の有無を調整できます。

  • 既存コードに初心者向け解説を付けたいとき
  • 構文や設計を選んだ理由の説明
  • 読み手の経験に合わせたコメント調整
github/awesome-copilot4.1万2026年10月29日 更新

github のスキルをすべて見る

このスキルの問題を報告する