fix: avoid duplicate draft releases when publishing multiple dry runs (next)#4327
Open
claude[bot] wants to merge 2 commits into
Open
fix: avoid duplicate draft releases when publishing multiple dry runs (next)#4327claude[bot] wants to merge 2 commits into
claude[bot] wants to merge 2 commits into
Conversation
When resuming multiple saved dry runs (publish --from-dry-run), the same PublisherGithub instance is asked to publish once per dry run. Each call listed the repository's releases to find the target release, but GitHub's list releases API is eventually consistent, so a release created seconds earlier by the previous call could be missing from the listing - causing a second, duplicate draft release to be created for the same tag and the platform assets to be split across the two drafts. Remember the releases found or created during this process, keyed by tag name, and consult that cache before hitting the list releases endpoint. Fixes #4325 # Conflicts: # packages/publisher/github/src/PublisherGithub.ts
3 tasks
The spec imported fs-extra, which is not a dependency of the publisher-github package on this branch (knip failed CI with an unlisted-dependency error); use node:fs/promises instead. Also stub GITHUB_TOKEN and pass an explicit authToken in the publisher config so the spec does not depend on ambient credentials — CI runners have no GITHUB_TOKEN and the GitHub client constructor throws without either. Mirrors the equivalent fix on the main-branch PR. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VpZV6TdUUfbWBHduegyqgc
erickzhao
approved these changes
Jul 22, 2026
erickzhao
marked this pull request as ready for review
July 22, 2026 22:39
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.
Requested via Slack thread
Summarize your changes:
Ports the fix for #4325 to
next— this is thenextport of #4326.Before: Running
electron-forge publish --from-dry-runwith multiple saved dry runs (e.g. one per platform) against the GitHub publisher could create two or more draft releases for the same version, with the assets split between them. Each restored dry run triggers its ownpublish()call on the same publisher instance, and each call re-lists releases to find an existing one — but GitHub's "list releases" API is eventually consistent, so it can miss the draft release created just seconds earlier by the previous dry run, causing a secondcreateReleasefor the same tag.After: Only one draft release is created per version. Subsequent
publish()calls in the same process reuse the release they just found or created instead of re-querying the eventually consistent listing.How: Same semantics as #4326, adapted to
next(where the source file isPublisherGitHub.ts): an instance-levelknownReleasesmap keyed by tag name is consulted before hitting the list/create APIs and populated after a release is found or created. The twoGetResponseDataTypeFromEndpointMethodtype aliases were hoisted from the method body to module scope so the map can be typed. The regression spec (packages/publisher/github/spec/PublisherGitHub.spec.ts) simulates the eventually consistent listing and asserts that publishing two dry-run results for the same version creates exactly one release with both assets uploaded to it. All 15 tests in the package pass onnext.Generated by Claude Code