Fix prerelease PR comment and add Slack notifications#531
Fix prerelease PR comment and add Slack notifications#531ignaciosantise merged 2 commits intodevelopfrom
Conversation
- Fix prerelease comment targeting wrong PR by using changesets action's pullRequestNumber output instead of broken commit API lookup - Add Slack notifications after snapshot and canary releases with version, tag, branch, actor, npm link, and install command - Applies to both snapshot.yml (workflow dispatch) and changesets.yml (main branch canary releases) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
|
Claude finished @ignaciosantise's task —— View job 🔍 Code Review CompleteTasks
Issues Found1. Critical: Script Injection Vulnerability in changesets.yml
The PR comment step uses unvalidated gh pr comment ${{ steps.changesets.outputs.pullRequestNumber }} \
--body "Published pre-release version: ${{ env.VERSION }}"Problem: If Fix: Use proper quoting with single quotes or escape the variable: gh pr comment ${{ steps.changesets.outputs.pullRequestNumber }} \
--body 'Published pre-release version: ${{ env.VERSION }}'Or use a heredoc: gh pr comment ${{ steps.changesets.outputs.pullRequestNumber }} \
--body "$(cat <<'EOF'
Published pre-release version: ${{ env.VERSION }}
EOF
)"2. Environment Variable vs Step Output Mismatch in changesets.yml
The step outputs echo "VERSION=$VERSION" >> $GITHUB_ENVBut it should also/instead use echo "VERSION=$VERSION" >> $GITHUB_OUTPUTThen reference it as Current impact: Works for same-job steps via 3. Missing Version in Environment for Slack Notification in changesets.yml
The Slack notification step uses Problem: If the "Get NPM Version" step fails or is skipped, Fix: Add explicit dependency or use step outputs: - name: Send Slack notification
if: steps.changesets.outputs.published != 'true' && steps.get_version.outputs.VERSION4. Inconsistent Output Method in snapshot.yml
This correctly uses echo "VERSION=$VERSION" >> $GITHUB_OUTPUTBut then the Slack notification on line 119 correctly references it as 5. Missing Error Handling for Slack NotificationsBoth The Slack notification steps don't have Impact: A failed Slack notification would mark the release as failed even though the publish succeeded. Fix: Add to both Slack steps: - name: Send Slack notification
if: steps.changesets.outputs.published != 'true'
continue-on-error: true6. Potential NPM Link 404 for Newly Published Versions
Both workflows link to npm with the version path immediately after publishing: Problem: npm CDN can take seconds to minutes to propagate. The link might 404 when clicked immediately. Recommendation: Use the package page without version suffix, or add a note that the link may take a few minutes to be available: Or keep version link but document the delay in the text. SummarySecurity: 1 script injection vulnerability in PR comment command The PR correctly fixes the main issue (using |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
There was a problem hiding this comment.
Pull request overview
This PR updates the release automation workflows to (1) comment the canary/pre-release version on the correct PR generated by changesets/action, and (2) send Slack notifications when snapshot and canary releases are published.
Changes:
- Switch PR commenting to use
changesets/action’spullRequestNumberoutput (instead of commit→PR lookup). - Add Slack incoming-webhook notifications after snapshot publishes.
- Add Slack incoming-webhook notifications after canary publishes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| .github/workflows/snapshot.yml | Adds steps to read the published version and send a Slack notification after snapshot publish. |
| .github/workflows/changesets.yml | Fixes PR commenting target via pullRequestNumber and adds Slack notification for canary publishes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add id to publish step and gate PR comment, version, and Slack steps on publish_prerelease.outcome == 'success' - Switch from GITHUB_ENV to GITHUB_OUTPUT for version consistency - Add continue-on-error to Slack steps so failures don't block releases Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
Thanks for the review. Here's what was addressed in 92fdf6e: 1. Script injection (PR comment) — Dismissed. 2. GITHUB_ENV vs GITHUB_OUTPUT inconsistency — Fixed. Switched to 3. Missing VERSION check for Slack — Fixed. Gated all downstream steps on 4. Inconsistent output method — Fixed (same as #2). 5. Missing continue-on-error on Slack steps — Fixed. Added 6. NPM link 404 on new versions — Dismissed. Minor UX issue not worth added complexity. Links resolve within minutes. |



Summary
Fixed the CI action that comments pre-release versions on PRs to target the correct PR, and added Slack notifications for both snapshot and canary releases.
Changes:
changesets/action'spullRequestNumberoutput instead of broken commit API lookupThe notifications include a direct link to the npm package and installation command for easy testing.
Test plan
Note
Low Risk
CI-only workflow changes affecting release notifications and PR comments; main risk is misconfigured secrets/webhook or conditional logic causing missed/duplicate notifications, not code/runtime behavior.
Overview
Fixes the canary prerelease workflow to comment on the correct PR by using
changesets/action’spullRequestNumberoutput (instead of commit-to-PR API lookup), and gates version extraction/commenting on the prerelease publish step succeeding.Adds best-effort Slack incoming-webhook notifications after successful canary and snapshot publishes, including the published version, tag, branch, actor, and an npm link/install hint; version is now passed between steps via
$GITHUB_OUTPUT.Written by Cursor Bugbot for commit 92fdf6e. This will update automatically on new commits. Configure here.