Skip to content

ci: support npm trusted publishing recovery#122

Merged
swernerx merged 1 commit into
mainfrom
codex/fix-release-publishing
Jul 22, 2026
Merged

ci: support npm trusted publishing recovery#122
swernerx merged 1 commit into
mainfrom
codex/fix-release-publishing

Conversation

@swernerx

Copy link
Copy Markdown
Member

Summary

  • grant the Release workflow the id-token: write permission required for npm Trusted Publishing
  • add a manual publish workflow input for recovering an already-created GitHub release
  • document npm Trusted Publishing, the NPM_TOKEN fallback, and the recovery procedure

Root cause

The v1.5.0 GitHub release was created successfully, but the publish step received an empty NPM_TOKEN. pnpm skipped OIDC because the workflow had no id-token: write permission and npm rejected the unauthenticated publish with 404 Not Found.

Validation

  • pnpm check
  • pre-push hook (pnpm check)

Required follow-up

Configure npm Trusted Publishing for sebastian-software/offcourse and .github/workflows/release-please.yml, or add an NPM_TOKEN repository secret. Then run the Release workflow manually with publish set to true to publish the existing v1.5.0 package.

Refs #92

@swernerx

Copy link
Copy Markdown
Member Author

@greptileai review

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds npm Trusted Publishing and a manual publication recovery path. The main changes are:

  • Grants OIDC token permission to the release workflow.
  • Adds a manual publish input for retrying npm publication.
  • Keeps NPM_TOKEN as an authentication fallback.
  • Documents the trusted publishing and recovery setup.

Confidence Score: 4/5

The manual publication path can target the wrong package version and may still select empty token authentication.

  • Manual checkout follows the selected branch instead of the failed release tag.
  • An absent fallback secret is still exported as an empty authentication token.
  • The normal release-created path otherwise preserves its existing publication gate.

.github/workflows/release-please.yml

Important Files Changed

Filename Overview
.github/workflows/release-please.yml Adds OIDC authentication and manual publishing, but recovery is not tied to the failed release tag and the empty token fallback may interfere with OIDC.
README.md Documents Trusted Publishing, token fallback, and the new manual recovery procedure.

Reviews (1): Last reviewed commit: "ci: support npm trusted publishing recov..." | Re-trigger Greptile

Comment on lines +36 to 37
if: ${{ steps.release.outputs.release_created || (github.event_name == 'workflow_dispatch' && inputs.publish) }}
uses: actions/checkout@v7

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Recovery Publishes Selected Branch

On a manual recovery, checkout uses the branch selected in the workflow UI rather than the tag for the failed release. If main has advanced before recovery, pnpm publish reads its current version and files, so the workflow can publish a different package or fail while leaving the intended release unpublished.

env:
# Trusted Publishing uses the workflow's id-token permission. NPM_TOKEN
# remains available as a fallback for token-based npm authentication.
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Empty Fallback Can Override OIDC

When NPM_TOKEN is not configured, this still exports NODE_AUTH_TOKEN as an empty value while setup-node has configured registry authentication around that variable. If pnpm treats the resulting token configuration as explicit authentication, it attempts an unauthenticated publish instead of Trusted Publishing, reproducing the recovery failure despite id-token: write; only set this environment variable when the fallback secret exists.

@swernerx
swernerx merged commit 9e4368d into main Jul 22, 2026
8 checks passed
@swernerx
swernerx deleted the codex/fix-release-publishing branch July 22, 2026 20:25
@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds npm Trusted Publishing support and a manual release-recovery path. The main changes are:

  • Grants the release workflow permission to request an OIDC token.
  • Adds a manual input that publishes the checked-out package version.
  • Documents Trusted Publishing, token fallback, and release recovery.

Confidence Score: 4/5

The manual recovery path should be bound to the intended release ref before merging.

  • Manual dispatch can publish from any selected branch or tag.
  • The normal push-driven release path remains gated by Release Please's output.
  • No separate issue was found in the documentation change.

.github/workflows/release-please.yml

Important Files Changed

Filename Overview
.github/workflows/release-please.yml Adds OIDC permission and manual publishing, but the recovery path is not tied to the release being recovered.
README.md Documents the updated authentication and recovery process.

Reviews (2): Last reviewed commit: "ci: support npm trusted publishing recov..." | Re-trigger Greptile


- name: Checkout repository
if: ${{ steps.release.outputs.release_created }}
if: ${{ steps.release.outputs.release_created || (github.event_name == 'workflow_dispatch' && inputs.publish) }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Recovery Publishes Selected Ref

A manual dispatch checks out whichever branch or tag the operator selects, while the skipped Release Please step provides no release commit to bind the run to. Selecting a feature branch or older tag with publish=true can therefore publish that ref's package contents instead of the contents of the existing GitHub release being recovered.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.81%. Comparing base (3436594) to head (d57033b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #122   +/-   ##
=======================================
  Coverage   47.81%   47.81%           
=======================================
  Files          50       50           
  Lines        5733     5733           
  Branches     1671     1713   +42     
=======================================
  Hits         2741     2741           
  Misses       2990     2990           
  Partials        2        2           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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