Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion dev/merge_spark_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lstrip() is used to remove the first PR template comments and new lines. strip() has false positive because it will modify all PR description (which doesn't have comments).

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"]
Expand Down