From 0b0e02e2c9ccd011a797eefe56bab254cb8babfa Mon Sep 17 00:00:00 2001 From: Dongjoon Hyun Date: Thu, 22 Aug 2019 22:44:56 -0700 Subject: [PATCH] [SPARK-28857][INFRA] Clean up the comments of PR template during merging --- dev/merge_spark_pr.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dev/merge_spark_pr.py b/dev/merge_spark_pr.py index 6901acca728a..fa3d50b8989f 100755 --- a/dev/merge_spark_pr.py +++ b/dev/merge_spark_pr.py @@ -495,7 +495,24 @@ def main(): else: title = pr["title"] - body = pr["body"] + modified_body = re.sub(re.compile(r'\n?', re.DOTALL), '', pr["body"]).lstrip() + if modified_body != pr["body"]: + print("=" * 80) + print(modified_body) + print("=" * 80) + print("I've removed the comments from PR template like the above:") + result = input("Would you like to use the modified body? (y/n): ") + if result.lower() == "y": + 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"]