Skip to content

Conversation

@BYK
Copy link
Member

@BYK BYK commented Dec 29, 2025

Summary

When a publish action fails (due to error or timeout) after creating a draft release, the draft is left orphaned on GitHub. This causes multiple draft releases with the same tag name to accumulate when someone re-runs the release.

Changes

  • Add deleteRelease method to GitHubTarget that safely deletes draft releases
  • The method refuses to delete non-draft releases as a safety measure
  • Wrap the publish flow in try-catch to clean up drafts on failure
  • Apply the same cleanup pattern to the UPM target
  • Add tests for draft release cleanup behavior

Testing

  • Added 4 new tests for deleteRelease method (draft check, non-draft refusal, undefined handling, dry-run)
  • Added 4 tests for publish cleanup behavior (publishRelease failure, deleteRelease failure, success case, uploadAsset failure)
  • All 641 tests pass

Fixes #388

@github-actions
Copy link
Contributor

github-actions bot commented Dec 29, 2025

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • (github) Clean up orphaned draft releases on publish failure by @BYK in #681

🤖 This preview updates automatically when you update the PR.

When a publish action fails after creating a draft release, the draft would
be left orphaned on GitHub. This caused multiple draft releases with the
same tag name to accumulate when re-running releases.

Changes:
- Add deleteRelease method to GitHubTarget that only deletes draft releases
- Wrap publish flow in try-catch to clean up drafts on failure
- Apply same cleanup pattern to UPM target
- Add tests for draft release cleanup behavior

Fixes #388
@BYK BYK force-pushed the fix/cleanup-orphaned-draft-releases branch from 3aa5bb9 to 21892c5 Compare December 29, 2025 15:39
@BYK BYK requested review from Lms24 and MathurAditya724 December 29, 2025 15:47
@BYK BYK marked this pull request as ready for review December 29, 2025 15:47
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@aldy505
Copy link

aldy505 commented Dec 30, 2025

@BYK how do I use this? Self-hosted has lots of open orphan issues, the latest one is getsentry/publish#6794

@BYK
Copy link
Member Author

BYK commented Dec 30, 2025

@aldy505 this is only for draft releases during a GitHub publish action. We need to clean up stale publish issues ourselves. I'll go over them and close as there are many old issues that are still open.

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.

Release drafts persist after failed publish attempt

4 participants