Skip to content

fix(release): enter npm-publish environment for scoped token - #27

Merged
qmarcelle merged 1 commit into
mainfrom
fix/meta-354-publish-job-enters-npm-publish-environment
Aug 19, 2026
Merged

fix(release): enter npm-publish environment for scoped token#27
qmarcelle merged 1 commit into
mainfrom
fix/meta-354-publish-job-enters-npm-publish-environment

Conversation

@qmarcelle

@qmarcelle qmarcelle commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Repairs the distinct release defect exposed by cli-v0.6.1: the publish job cleared architecture, build, typecheck, tests, and tarball verification, then failed the credential guard because NPM_TOKEN is an environment secret on npm-publish and the job never entered that environment.

0.6.1 never reached npm. This PR prepares @workspacejson/cli@0.6.2 with no package, mining, retrieval, provenance, or artifact behavior changes.

Change

  • add environment: npm-publish to the publish job so the scoped environment secret is available
  • add name: npm-publish so the Actions UI label matches the environment boundary
  • correct workflow documentation from “repository secret” to the actual environment-scoped secret
  • record why widening NPM_TOKEN to repository scope would be the wrong repair
  • bump the unpublished release line from 0.6.1 to 0.6.2
  • retain the failed 0.6.0 and 0.6.1 tags and their distinct pre-publish failures as release evidence

Release history

  • cli-v0.6.0: stopped at tarball integrity gate; never published
  • cli-v0.6.1: passed the repaired tarball gate, stopped at credential-scope gate; never published
  • cli-v0.6.2: candidate containing both prior repairs plus the environment declaration

Verification reported on branch

  • clean build
  • typecheck
  • 218 tests
  • architecture guard + 21 red tests
  • package-docs guard + 12 red tests
  • tarball verification under both packers
  • 5 tarball red tests

Merge only after GitHub CI confirms the branch from a clean checkout.

Summary by Sourcery

Enable the CLI publish workflow to release version 0.6.2 using the correctly scoped npm publishing environment.

Bug Fixes:

  • Fix the npm publish workflow so the publish job can access the environment-scoped NPM_TOKEN and complete releases.

CI:

  • Align the publish job name and environment with the npm-publish boundary and clarify the credential scope in workflow documentation.

Documentation:

  • Document the failed 0.6.1 release, the environment-scoped credential requirement, and the 0.6.2 release history.

Chores:

  • Bump the CLI package and repository manifest references from 0.6.1 to 0.6.2 while preserving the prior failed release tags.

…s in scope

`@workspacejson/cli@0.6.1` was tagged but never published. Its run cleared every
gate — guards, build, typecheck, tests, and the tarball verification that
stopped 0.6.0 — then failed the credential check with both variables empty:

    NODE_AUTH_TOKEN:
    NPM_TOKEN:

NPM_TOKEN is an ENVIRONMENT secret on `npm-publish`, and this repository holds
no repository-level NPM_TOKEN at all. GitHub exposes an environment secret only
to a job that declares `environment:`. This job never did, so
`${{ secrets.NPM_TOKEN }}` resolved to the empty string and the guard reported a
missing credential on a repository whose credential was correct all along.

`publish` is the job id. `npm-publish` is the environment. Nothing in the run
output distinguished them, which is most of why this read as a token problem.

The job now declares `environment: npm-publish`, and takes `name: npm-publish`
so a reader of a failed run sees the same word in the job label and in the scope
it needs. The header said "Required repository secret"; it now names the
environment secret actually required, and records why the token is scoped that
way — the environment is the reviewer-gateable boundary the standard's own
releases publish behind, so widening the token to the repository would have been
the wrong repair.

Not re-run, re-tagged: a re-run replays the workflow as it existed at the tagged
commit, and cli-v0.6.1 points at a commit with no `environment:` line, so it
would fail identically. The failed tags stay. 0.6.0 and 0.6.1 each record a real
defect stopped before anything reached the registry, which is better evidence
than a history in which the gates never fired.

Version bumped to 0.6.2. No package, mining, retrieval, provenance or artifact
behavior changes; the 0.5.0 authority migration and the 0.6.1 packaging-boundary
repair both ship here unchanged.
Copilot AI lite review requested due to automatic review settings August 19, 2026 10:37

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

qmarcelle has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sourcery-ai

sourcery-ai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Reviewer's Guide

Fixes the CLI publish workflow so the npm-publish environment (and its NPM_TOKEN secret) is actually entered, and bumps the CLI from 0.6.1 to 0.6.2 with documentation clarifying the failed 0.6.0/0.6.1 releases and the environment-scoped token choice.

Flow diagram for publish job entering npm-publish environment

flowchart LR
  JobPublish[Job publish]
  Env[Environment npm-publish]
  Secret[Environment secret NPM_TOKEN]
  Registry[NPM registry]

  JobPublish -->|environment: npm-publish| Env
  Env --> Secret
  JobPublish -->|uses secrets.NPM_TOKEN| Secret
  JobPublish -->|npm publish| Registry
Loading

File-Level Changes

Change Details Files
Ensure the publish job enters the npm-publish environment so the NPM_TOKEN environment secret is available, and document why the token remains environment-scoped.
  • Change workflow header to describe NPM_TOKEN as an environment-scoped secret and explain the 0.6.1 failure caused by missing environment declaration.
  • Add job-level name: npm-publish for clearer Actions UI labeling aligned with the environment name.
  • Add job-level environment: npm-publish so GitHub exposes the NPM_TOKEN environment secret to the publish job, with inline comments about name vs environment and blast-radius reasoning.
.github/workflows/publish-cli.yml
Record the 0.6.2 release as a workflow-only fix for 0.6.1, including detailed explanation of the credential gate failure and why tags 0.6.0/0.6.1 remain.
  • Add 0.6.2 entry describing that the only behavior change is entering the npm-publish environment, with no package/mining/provenance/artifact changes.
  • Describe how 0.6.1 passed all guards except credential scope, why rerunning would still fail, and why tags 0.6.0/0.6.1 are retained as evidence of pre-publish failures.
packages/cli/CHANGELOG.md
Align README and package metadata with the new 0.6.2 CLI version and clarify release history.
  • Update README registry snapshot narrative to describe 0.6.0 and 0.6.1 as tagged but unpublished, and that manifests now declare 0.6.2.
  • Update README manifest table row for @workspacejson/cli from 0.6.1 to 0.6.2.
  • Bump @workspacejson/cli package.json version field from 0.6.1 to 0.6.2.
README.md
packages/cli/package.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sonarqubecloud

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The workflow header and inline comments around the npm-publish environment are very long; consider tightening this prose to the minimum needed to explain the environment vs repository secret distinction so the CI file stays easy to scan.
  • The detailed release history and failure narratives for 0.6.0/0.6.1 are repeated across the changelog and README; consider centralizing that explanation in one place and referencing it from the other to avoid future divergence.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The workflow header and inline comments around the `npm-publish` environment are very long; consider tightening this prose to the minimum needed to explain the environment vs repository secret distinction so the CI file stays easy to scan.
- The detailed release history and failure narratives for 0.6.0/0.6.1 are repeated across the changelog and README; consider centralizing that explanation in one place and referencing it from the other to avoid future divergence.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@qmarcelle
qmarcelle merged commit 5d9971b into main Aug 19, 2026
7 checks passed
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.

2 participants