Skip to content

fix(ci): always run release cleanup on failure#153

Merged
jaysin586 merged 1 commit into
mainfrom
fix/release-cleanup-always-run
May 28, 2026
Merged

fix(ci): always run release cleanup on failure#153
jaysin586 merged 1 commit into
mainfrom
fix/release-cleanup-always-run

Conversation

@jaysin586

Copy link
Copy Markdown
Contributor

Problem

In .github/workflows/npm-publish.yml, the Cleanup on failure step is gated on:

if: failure() && steps.create_release.outcome == 'success'

The version-bump step pushes the commit and tag before the release step runs. If gh release create itself fails, this cleanup is skipped (its condition requires create_release to have succeeded), so the branch/tag are left ahead of npm/GitHub Releases — a partial-release state that needs manual repair.

Fix

- if: failure() && steps.create_release.outcome == 'success'
+ if: failure()
...
-   gh release delete "$RELEASE_VERSION" --yes
-   git tag -d "$RELEASE_VERSION"
-   git push --delete origin "$RELEASE_VERSION"
+   gh release delete "$RELEASE_VERSION" --yes || true
+   git tag -d "$RELEASE_VERSION" || true
+   git push --delete origin "$RELEASE_VERSION" || true
  • if: failure() ensures cleanup always runs when the job fails, including when gh release create is the thing that failed.
  • The || true guards keep one already-missing artifact (e.g. a release that never got created) from aborting the remaining cleanup commands.

Context

Originally flagged by CodeRabbit on humanspeak/svelte-purify#56 and fixed there. This same templated workflow carries the bug across the org; this PR applies the identical fix here. Verified the change is exactly the condition line plus the three cleanup commands — no other changes.

🤖 Generated with Claude Code

The "Cleanup on failure" step in npm-publish.yml was gated on
`failure() && steps.create_release.outcome == 'success'`, so if
`gh release create` itself failed, cleanup was skipped and the bumped
commit/tag were left pushed with no npm/GitHub release. Drop the
create_release gate (`if: failure()`) and add `|| true` to the cleanup
commands so one missing artifact doesn't abort the rest.

Same fix as humanspeak/svelte-purify (CodeRabbit finding).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jaysin586, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 5 minutes and 48 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e47050cf-8cab-4816-b378-fb6d352519de

📥 Commits

Reviewing files that changed from the base of the PR and between 4ea020f and 799f732.

📒 Files selected for processing (1)
  • .github/workflows/npm-publish.yml

Comment @coderabbitai help to get the list of available commands and usage tips.

@jaysin586 jaysin586 merged commit 9269d88 into main May 28, 2026
2 of 3 checks passed
@jaysin586 jaysin586 deleted the fix/release-cleanup-always-run branch May 28, 2026 11:58
@jaysin586

Copy link
Copy Markdown
Contributor Author

❌ Release workflow failed. Please check the workflow logs

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