Fix publish workflow to skip existing GitHub releases#7
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
📦 Bundle Size Report
|
There was a problem hiding this comment.
Pull request overview
This pull request adds a safety check to the publish workflow to prevent failures when attempting to create a GitHub release that already exists. This addresses scenarios where releases are created manually before the automated workflow runs.
Changes:
- Added a pre-flight check using
gh release viewto detect existing releases before attempting creation - Implements graceful skipping with informative console output when a release already exists
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Skip if release already exists | ||
| if gh release view "v$VERSION" > /dev/null 2>&1; then | ||
| echo "Release v$VERSION already exists, skipping" | ||
| exit 0 | ||
| fi |
There was a problem hiding this comment.
Consider checking for the existing release at the start of the job, before the npm publish step. This would provide better fail-fast behavior and clearer feedback. Additionally, consider checking if the npm package version already exists to provide a complete idempotency check. The current placement after npm publish means the workflow will still execute build, test, and npm publish steps even when the release already exists, wasting CI resources and potentially causing confusing errors if the npm version was also already published.
Summary
Test plan
🤖 Generated with Claude Code