Repository navigation
fix(publish): Fail the publish when the release branch merge fails - #965
Merged
Merged
Conversation
Every target has published by then, but a warning hid broken releases: the release branch stayed unmerged and postReleaseBump was skipped. Throw ReleaseBranchMergeError with recovery steps instead, and keep the publish state so a retry skips the published targets and only merges. Branch cleanup failures after a pushed merge stay warnings. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Contributor
|
BYK
reviewed
Nov 5, 2026
BYK
left a comment
Member
There was a problem hiding this comment.
Not changed: the getsentry/publish failure comment still says "Bad branch? You can delete with ease and start over". For a merge failure that's the wrong advice: deleting the branch makes the retry fail with "Could not find the release branch".
Let's file an issue to fix this with useful advice
BYK
approved these changes
Nov 5, 2026
8 tasks done
BYK
added a commit
to getsentry/publish
that referenced
this pull request
Nov 6, 2026
…rgets done (#10269) Companion to getsentry/craft#965. With that change, Craft fails the publish when it can't merge the release branch back, even though every target already shipped. The failure comment here then says "Bad branch? You can delete with ease and start over", which is the wrong advice: the version is already out, so starting over can't work, and the fix is to retry. **What changed** - The "Inform about failure" and "Inform about cancellation" steps now get `CRAFT_STATE_FILE_PATH` (the same `.issue` hard link that "Update completed targets" reads). - `post-result.js` reads the published targets from it. When any target is checked, the comment lists them and says to fix the cause in the run logs and re-add `accepted`, because the retry skips the checked targets. Otherwise the comment keeps the "Bad branch?" link. - If the state file can't be read, the step logs a warning and posts the default comment, so a bad state file can't drop the failure comment. Example: > Failed to publish. ([run logs](…)) > > _Already done: `npm`, `github`. Don't delete the release branch and start over. Fix the cause in the run logs, then add the `accepted` label again: the retry skips the done targets._ **Caveat:** the state file also has targets that someone checked by hand to skip them, so a run that fails before it publishes anything but has hand-checked targets gets the retry advice too. I think that's fine, because retrying is still safe there. **Verification:** `pnpm test` (163 tests) and `pnpm lint` pass. The new tests cover the comment with and without done targets, reading the state file (present, missing, unreadable), and the workflow wiring. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:local%3Aweb%3A5a127b87e1c9aa82f1ac698f --> -- [View Session in Sentry](https://sentry.sentry.io/explore/conversations/local%3Aweb%3A5a127b87e1c9aa82f1ac698f/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <126780+BYK@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #964. When Craft can't merge the release branch back, it now fails the publish instead of logging a warning. That way the failure shows up in getsentry/publish and can be retried or recovered from there.
The toolkit
cli/0.48.0publish (job log) is the motivating case. Every target shipped, but the merge hit a conflict. Craft warned and reported success, so the run was green while the release branch stayed unmerged andpostReleaseBumpwas skipped. Someone had to read the logs to notice. getsentry/toolkit#2028 cleans up that release.What changed
handleReleaseBranchfails with a merge conflict, a push failure, or any other error,craft publishnow throwsReleaseBranchMergeError. The error says every target published and lists the conflicting files and the diff. It also says how to recover:acceptedretries only the merge.BranchCleanupErrorstays a warning, because the merge was already pushed and a retry can't help.captureExceptioncall in the merge path.This reverses the earlier decision that the merge is non-blocking housekeeping. I updated
.lore.mdand the release-workflow docs to match.Verification
publishMaintests: a merge conflict and a push failure both reject withReleaseBranchMergeErrorand keep the state file, and a failed merge skips the bump. The existing cleanup-failure test still passes as a warning.pnpm lintandtscpass, and thesrc/commandsand resolver tests pass (91 tests). In the fullpnpm test, the only failures are the same e2e failures (24 inprepare-dry-run.e2eand one other file) that I also see onmasterin my sandbox.Companion: getsentry/publish#10269 fixes the getsentry/publish failure comment. That comment says "Bad branch? You can delete with ease and start over", which is the wrong advice once targets have published, because the version is already out. It now lists the done targets and says to retry by re-adding
accepted.via @BYK.
--
View Session in Sentry