mumrah commented on code in PR #19168:
URL: https://github.com/apache/kafka/pull/19168#discussion_r1987459608
##########
committer-tools/reviewers.py:
##########
@@ -35,6 +37,30 @@ def prompt_for_user():
return clean_input
+def append_message_to_pr_body(pr_url, message):
+ try:
+ cmd_get_pr = ["gh", "pr", "view", pr_url, "--json", "title,body"]
+ result = subprocess.run(cmd_get_pr, capture_output=True, text=True,
check=True)
+ current_pr_body = json.loads(result.stdout).get("body", {})
+ pr_title = json.loads(result.stdout).get("title", {})
+ escaped_message = message.replace("<", "\\<").replace(">", "\\>")
Review Comment:
If a PR already has "Reviewers" we need to parse that here so we can replace
it. I can think of two ways we can do this
1) (Easier option) Parse the body with Python. Find a line at the end of the
body starting with "Reviewers" and replace it.
2) (More robust option) Use `git interpret-trailers` to parse and even
update the message (see
https://github.com/apache/kafka/blob/trunk/.github/scripts/pr-format.py#L54 for
example)
Also, we should not escape the brackets around the email. It indeed renders
a bit funny in the PR, but when auto-filling the commit message, it appears as
it should.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]