Skip to content

Clean up a failed release so the next dispatch starts clean - #4938

Merged
Mpdreamz merged 2 commits into
mainfrom
feature/release-cleanup-on-failure
Nov 20, 2026
Merged

Mpdreamz merged 2 commits into
mainfrom
feature/release-cleanup-on-failure

Conversation

@Mpdreamz

@Mpdreamz Mpdreamz commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

A failed or cancelled release removes its tag and attached assets, and the next dispatch starts clean. The manual trigger no longer takes a version.

Affects: Automation

Prompt summary: Make the release workflow resilient and clean up after a failed release by removing its artifacts and tag. Remove the version input from the manual trigger, because release-drafter owns the version.

Why

The 1.79.0 release failed on the Windows build and left a tag and a draft release with attached assets. Run 44271615615 then failed at Create tag (Reference already exists), and run 44272054694 failed at every gh release upload (asset under the same name already exists). Recovery took a manual tag delete, a manual delete of 12 assets, and a version input (#4935) that lets a dispatcher make up a version.

What

Cleanup job

A new cleanup-failed-release job runs when any release job, including the three reusable build jobs, fails or the run is cancelled. It deletes the assets of the draft release and the tag, and keeps the draft, which release-drafter reuses. It exits without changes when the release is published or does not exist, so a published release is never touched. Only an absent release or tag counts as nothing to clean: any other gh error fails the job. notify-failure waits for it, so a failed cleanup alerts too.

Re-dispatch without cleanup

If cleanup did not run, the Create tag step still passes. It creates a missing tag, accepts a tag at the right commit, and moves a tag that no published release uses. A new step then deletes any assets on the draft before the build jobs attach new ones, and every gh release upload uses --clobber.

Version input

workflow_dispatch goes back to no inputs, and the release-drafter step calculates the version again.

Risk: The job deletes a tag and release assets, and only from a draft release. After a failure, dispatch the workflow again: "Re-run failed jobs" needs the tag that cleanup removes.

Out of scope: The containers push edge and latest and the Lambdas deploy to prod before the release is published. A re-dispatch pushes and deploys them again, which is acceptable.

Verify

actionlint .github/workflows/release.yml   # reports only the existing `$/` paths
zizmor .github/workflows/release.yml       # No findings to report

The cleanup script was run with a stubbed gh for a draft, a published and a missing release, with and without a tag, and with API errors on the release list, the tag lookup and the tag delete. Each error exits 1. Against the published 1.80.0 and a missing 9.9.9 it leaves everything alone. The failure path is untested end to end until a release fails or is cancelled.

🤖 Generated with Claude Code

… input

A failed or cancelled release left a tag and attached assets, and the next dispatch failed on both. A new job removes them from a draft, the tag step and the upload steps tolerate leftovers, and the `version` input goes because release-drafter owns the version.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@Mpdreamz
Mpdreamz requested a review from a team as a code owner November 18, 2026 09:35
@Mpdreamz Mpdreamz added the automation packaging, ci/cd. label Nov 18, 2026
@Mpdreamz
Mpdreamz requested a review from akira28 November 18, 2026 09:35
Comment thread .github/workflows/release.yml Resolved
Comment thread .github/workflows/release.yml Resolved
…rrors

The `cleanup-failed-release` job now waits for the three reusable build jobs, so their failures trigger it. A missing release or tag is nothing to clean, and any other `gh` failure fails the job, so `notify-failure` alerts.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@Mpdreamz
Mpdreamz merged commit 67d840a into main Nov 20, 2026
46 checks passed
@Mpdreamz
Mpdreamz deleted the feature/release-cleanup-on-failure branch November 20, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation packaging, ci/cd.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant