Skip to content

ci(npm): add manual_otp workflow_dispatch auth path#68

Merged
johnnyhuy merged 1 commit into
mainfrom
ci/npm-manual-otp-dispatch
Jun 21, 2026
Merged

ci(npm): add manual_otp workflow_dispatch auth path#68
johnnyhuy merged 1 commit into
mainfrom
ci/npm-manual-otp-dispatch

Conversation

@johnnyhuy

Copy link
Copy Markdown
Contributor

Summary

Adds a manual_otp workflow_dispatch auth path to npm-publish.yaml so releases can be unblocked when the OIDC trusted publisher path returns 404 'getskillet is not in this registry'. The legacy OIDC path is unchanged and remains the default for release: published events.

Changes

  • .github/workflows/npm-publish.yaml:
    • Two new workflow_dispatch inputs: auth_method (oidc | manual_otp, default oidc) and npm_otp (2FA code, masked in logs).
    • New step Configure manual OTP auth that:
      • Validates secrets.NPM_TOKEN is present on the production environment.
      • Validates inputs.npm_otp is supplied.
      • Writes NODE_AUTH_TOKEN=${NPM_TOKEN} to $GITHUB_ENV, overriding the OIDC value from actions/setup-node.
      • Sets NPM_OTP_CONFIGURED=true so the publish steps know to pass --otp.
    • Publish package and Publish scoped alias steps now pass --otp="${NPM_OTP}" when the manual path is selected.
  • docs/distribution/npm.md:
    • New "Manual OTP bootstrap publish" section documenting the prerequisite of adding NPM_TOKEN as an environment secret on production and the dispatch flow.

Consequences

  • An environment secret NPM_TOKEN needs to be added manually on the production GitHub environment before this path can be exercised. (Cannot be done from this PR.)
  • Anyone with workflow: write access to the repo and access to the production environment can dispatch with manual_otp. The OTP code is masked in logs but is visible in the dispatch payload. Recommend rotating the OTP after each dispatch and the NPM_TOKEN secret if it was ever exposed.

Testing

  • mise run ci passes: 21 test files, 103 tests pass; npm publish dry-run succeeds.
  • YAML validated with python3 -c "import yaml; yaml.safe_load(open('.github/workflows/npm-publish.yaml'))".
  • Manual npm-publish.yaml dispatch with auth_method=oidc and the existing setup continues to use OIDC and is unchanged.

Follow-ups

  • Resolve the underlying OIDC 404 so manual OTP is the exception, not the norm. Track separately.
  • Once NPM_TOKEN is added as a production environment secret, document the bootstrap publish procedure in AGENTS.md so it's discoverable for future releases.

The OIDC trusted publisher path keeps returning
`404 'getskillet is not in this registry'` from the production
environment despite repeated debug iterations. To unblock releases
when the OIDC path is broken, add a manual_otp dispatch path:

- Two new `workflow_dispatch` inputs: `auth_method` (oidc|manual_otp)
  and `npm_otp` (the current 2FA OTP code).
- A `Configure manual OTP auth` step writes `NODE_AUTH_TOKEN` from
  the `NPM_TOKEN` environment secret to `$GITHUB_ENV`, overriding the
  value that `actions/setup-node` set via OIDC. The publish steps then
  pass `--otp` so both `getskillet` and `@echohello/skillet` are
  published with the same one-time password.
- The legacy OIDC path is unchanged and remains the default.
- `docs/distribution/npm.md` documents the bootstrap flow and the
  prerequisite of adding `NPM_TOKEN` to the production environment.

Co-authored-by: codex@echohello.dev
@johnnyhuy johnnyhuy merged commit b147914 into main Jun 21, 2026
12 checks passed
@johnnyhuy johnnyhuy deleted the ci/npm-manual-otp-dispatch branch June 21, 2026 12:02
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.

1 participant