This is an automated email from the ASF dual-hosted git repository.

zhengruifeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 1eabbed9e1be [SPARK-57077][INFRA] Prevent merging draft PRs in merge 
script
1eabbed9e1be is described below

commit 1eabbed9e1be713460d6a7df8f687f3d697bb617
Author: Ruifeng Zheng <[email protected]>
AuthorDate: Wed May 27 13:29:20 2026 +0800

    [SPARK-57077][INFRA] Prevent merging draft PRs in merge script
    
    ### What changes were proposed in this pull request?
    
    Add a fail-hard check in `dev/merge_spark_pr.py` that 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's `draft` flag 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.py` still 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)
    
    Closes #56120 from zhengruifeng/merge-script-block-draft-pr-dev3.
    
    Authored-by: Ruifeng Zheng <[email protected]>
    Signed-off-by: Ruifeng Zheng <[email protected]>
---
 dev/merge_spark_pr.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dev/merge_spark_pr.py b/dev/merge_spark_pr.py
index 2bd96016ec30..f263c449333d 100755
--- a/dev/merge_spark_pr.py
+++ b/dev/merge_spark_pr.py
@@ -1116,9 +1116,9 @@ def main():
     url = pr["url"]
     title = pr["title"]
 
-    # Fail hard on WIP or DO-NOT-MERGE to prevent accidental merges.
-    if "[WIP]" in title or "[DO-NOT-MERGE]" in title:
-        fail("Cannot merge a PR with [WIP] or [DO-NOT-MERGE] in the 
title:\n%s" % title)
+    # Fail hard on draft, WIP, or DO-NOT-MERGE PRs to prevent accidental 
merges.
+    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))
 
     # e.g. 'Revert "[SPARK-56357][BUILD] Upgrade sbt to 1.12.8"'
     is_revert_pr = title.startswith('Revert "') and title.endswith('"')


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to