fix(release): restore npm publish auth checks - #25
Conversation
WalkthroughThe release workflow updates the publish-npm job to propagate pipeline failures during npm publish and to make tarball download errors explicit before SHA256 calculation. ChangesRelease Workflow Error Handling
Sequence Diagram(s)Not applicable — the change is limited to shell flag updates in a CI workflow. Estimated code review effort: 1 (~5 minutes) Related issues: None provided. Related PRs: None provided. Suggested labels: ci, chore Suggested reviewers: None provided. 🐰 Publish now fails when pipes fail, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
285d249 to
ab3ade9
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.github/workflows/release.yml (2)
205-205: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low valueConsider passing
NPM_TAGviaenv:to silence the template-injection hint.zizmor flags direct
${{ steps.npm_tag.outputs.tag }}interpolation into the shell script at Line 205. The value is workflow-derived (fixed tobeta/alpha/rc/latest) so exploitability is low here, but routing it throughenv:is a cheap way to close the finding and follow GitHub's hardening guidance forrun:blocks.🔧 Suggested refactor
- name: Publish to npm + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_TAG: ${{ steps.npm_tag.outputs.tag }} run: | set -o pipefail - npm publish --provenance --access public --tag ${{ steps.npm_tag.outputs.tag }} 2>&1 | tee npm-publish.log || { + npm publish --provenance --access public --tag "$NPM_TAG" 2>&1 | tee npm-publish.log || { if grep -q "You cannot publish over the previously published versions" npm-publish.log; then echo "Version already published, skipping..." else exit 1 fi } - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}Also applies to: 213-213
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/release.yml at line 205, Move the npm dist-tag value out of direct shell interpolation in the release workflow: in the publish step(s) that use npm publish, pass the tag from steps.npm_tag.outputs.tag through env as NPM_TAG and reference that variable in the run block instead of embedding the expression directly. Apply the same change to both publish commands so the workflow uses a shell variable rather than template interpolation.Source: Linters/SAST tools
219-221: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low valueOptional: pass
VERSIONviaenv:to address the second template-injection hint.Same pattern as Line 205 — zizmor flags Line 219's inline
${{ needs.check-version.outputs.current }}. Low risk given the value's provenance, but worth aligning with theenv:approach for consistency and to clear the static-analysis finding.🔧 Suggested refactor
- name: Calculate SHA256 id: sha256 + env: + VERSION: ${{ needs.check-version.outputs.current }} run: | sleep 10 - VERSION="${{ needs.check-version.outputs.current }}" TARBALL_URL="https://registry.npmjs.org/@clix-so/clix-cli/-/clix-cli-${VERSION}.tgz" curl --fail --silent --show-error --location "$TARBALL_URL" -o package.tgz🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/release.yml around lines 219 - 221, The release workflow step is using an inline GitHub expression to populate VERSION, which triggers the template-injection finding and is inconsistent with the safer pattern used earlier in the workflow. Move the current version value from needs.check-version.outputs.current into env: for this step, then reference that environment variable when building TARBALL_URL and downloading the tarball, keeping the behavior unchanged while removing the inline expression from the shell block.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/workflows/release.yml:
- Line 205: Move the npm dist-tag value out of direct shell interpolation in the
release workflow: in the publish step(s) that use npm publish, pass the tag from
steps.npm_tag.outputs.tag through env as NPM_TAG and reference that variable in
the run block instead of embedding the expression directly. Apply the same
change to both publish commands so the workflow uses a shell variable rather
than template interpolation.
- Around line 219-221: The release workflow step is using an inline GitHub
expression to populate VERSION, which triggers the template-injection finding
and is inconsistent with the safer pattern used earlier in the workflow. Move
the current version value from needs.check-version.outputs.current into env: for
this step, then reference that environment variable when building TARBALL_URL
and downloading the tarball, keeping the behavior unchanged while removing the
inline expression from the shell block.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c187f59e-27c3-4750-a127-f135eb7c5ce3
📒 Files selected for processing (1)
.github/workflows/release.yml
Summary
Restore npm token authentication in the release workflow and make npm publish failures fail the run.
Details
The v1.1.3 release workflow created GitHub binary assets, but npm publish failed with E404 and the failure was hidden by
tee. This PR keeps provenance enabled, restoresNODE_AUTH_TOKENfromsecrets.NPM_TOKEN, addspipefail, and makes the npm tarball checksum download fail on HTTP errors.Related Issues
N/A
How to Validate
bun run check && bun testbun run build && bun test tests/e2e/.github/workflows/release.ymlsetsNODE_AUTH_TOKENfornpm publish.github/workflows/release.ymlusesset -o pipefailbeforenpm publish | teecurl --failfor the npm tarballPre-Merge Checklist
Code Quality
bun run build)bun run typecheck)bun run lint)bun test)Documentation
Commit Standards
Platform Validation