[SPARK-57077][INFRA] Prevent merging draft PRs in merge script#56120
Closed
zhengruifeng wants to merge 2 commits into
Closed
[SPARK-57077][INFRA] Prevent merging draft PRs in merge script#56120zhengruifeng wants to merge 2 commits into
zhengruifeng wants to merge 2 commits into
Conversation
Generated-by: Claude Code (Opus 4.7)
Contributor
Author
|
use the updated script to merge this draft PR gets: (spark-dev-313) ➜ spark git:(merge-script-block-draft-pr-dev3) dev/merge_spark_pr.py
git rev-parse --abbrev-ref HEAD
Which pull request would you like to merge? (e.g. 34): 56120
Cannot merge a draft PR #56120: [SPARK-57077][INFRA] Prevent merging draft PRs in merge script
Restoring head pointer to merge-script-block-draft-pr-dev3
git checkout merge-script-block-draft-pr-dev3
Already on 'merge-script-block-draft-pr-dev3'
git branch
Restoring head pointer to merge-script-block-draft-pr-dev3
git checkout merge-script-block-draft-pr-dev3
Already on 'merge-script-block-draft-pr-dev3'
git branch |
|
|
||
| # Fail hard on draft PRs to prevent accidental merges. | ||
| if pr.get("draft", False): | ||
| fail("Cannot merge a draft PR #%s: %s" % (pr_num, title)) |
Member
There was a problem hiding this comment.
Since this is simple, could you merge this into the above existing logic like the following? I guess this new message is more proper to cover all WIP cases.
if pr.get("draft", False) or "[WIP]" in title or "[DO-NOT-MERGE]" in title:
fail("Cannot merge a draft PR #%s: %s" % (pr_num, title))Generated-by: Claude Code (Opus 4.7)
HyukjinKwon
approved these changes
May 27, 2026
cloud-fan
approved these changes
May 27, 2026
Contributor
Author
|
thanks, merged to master |
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.
What changes were proposed in this pull request?
Add a fail-hard check in
dev/merge_spark_pr.pythat aborts when the target PR is a draft (pr["draft"] == True). The check sits next to the existing[WIP]/[DO-NOT-MERGE]title guard.Why are the changes needed?
A draft PR is, by definition, not ready for merge. The script today only inspects the title for
[WIP]/[DO-NOT-MERGE], so a committer who runs it against a draft PR whose title looks final can still kick off the merge flow. Checking the GitHub API'sdraftflag closes that gap.Does this PR introduce any user-facing change?
No. Committer tooling only.
How was this patch tested?
Existing doctests in
dev/merge_spark_pr.pystill pass (python3 -m doctest dev/merge_spark_pr.py— 57/57).Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.7)