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

srowen 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 8d8fac2f591 [MINOR][BUILD] Handle empty PR body in merge script
8d8fac2f591 is described below

commit 8d8fac2f59122e101a2e7f74cd4971c1d7152797
Author: Sean Owen <sro...@gmail.com>
AuthorDate: Tue Oct 11 13:59:36 2022 -0500

    [MINOR][BUILD] Handle empty PR body in merge script
    
    ### What changes were proposed in this pull request?
    
    Handle the case where the PR body is empty, when merging a PR with the 
merge script.
    
    ### Why are the changes needed?
    
    The script fails otherwise.
    Although we should not have empty PR descriptions, it should at least not 
break the script.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No
    
    ### How was this patch tested?
    
    N/A
    
    Closes #38207 from srowen/DevMergePrBody.
    
    Authored-by: Sean Owen <sro...@gmail.com>
    Signed-off-by: Sean Owen <sro...@gmail.com>
---
 dev/merge_spark_pr.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/dev/merge_spark_pr.py b/dev/merge_spark_pr.py
index e21a39a6881..1621432c01c 100755
--- a/dev/merge_spark_pr.py
+++ b/dev/merge_spark_pr.py
@@ -508,8 +508,11 @@ def main():
     else:
         title = pr["title"]
 
-    modified_body = re.sub(re.compile(r"<!--[^>]*-->\n?", re.DOTALL), "", 
pr["body"]).lstrip()
-    if modified_body != pr["body"]:
+    body = pr["body"]
+    if body is None:
+        body = ""
+    modified_body = re.sub(re.compile(r"<!--[^>]*-->\n?", re.DOTALL), "", 
body).lstrip()
+    if modified_body != body:
         print("=" * 80)
         print(modified_body)
         print("=" * 80)
@@ -519,13 +522,10 @@ def main():
             body = modified_body
             print("Using modified body:")
         else:
-            body = pr["body"]
             print("Using original body:")
         print("=" * 80)
         print(body)
         print("=" * 80)
-    else:
-        body = pr["body"]
     target_ref = pr["base"]["ref"]
     user_login = pr["user"]["login"]
     base_ref = pr["head"]["ref"]


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to