chia7712 commented on code in PR #19168:
URL: https://github.com/apache/kafka/pull/19168#discussion_r1986329085
##########
committer-tools/reviewers.py:
##########
@@ -35,6 +37,31 @@ 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", {})
+ print(f"The new PR body will be:\n{current_pr_body}{message}")
Review Comment:
please remove the debug message
##########
committer-tools/reviewers.py:
##########
@@ -35,6 +37,31 @@ 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", {})
+ print(f"The new PR body will be:\n{current_pr_body}{message}")
+ escaped_message = message.replace("<", "\\<").replace(">", "\\>")
+ updated_pr_body = f"{current_pr_body}{escaped_message}"
+ except subprocess.CalledProcessError as e:
+ print("Failed to retrieve PR description:", e.stderr)
+ return
+
+ choice = input(f"Update the body of {pr_title}? (y/n): ").strip().lower()
Review Comment:
Also, there are duplicate messages
```
// here
Update the body of KAFKA-18942: Add reviewers to PR body with
committer-tools? (y/n): y
https://github.com/apache/kafka/pull/19168
PR description updated successfully!
```
Reviewers: Chia-Ping Tsai \<[email protected]\>, TengYao Chi
\<[email protected]\>
Reviewers: Chia-Ping Tsai <[email protected]>
// here
Update the body of KAFKA-18942: Add reviewers to PR body with
committer-tools? (y/n): y
https://github.com/apache/kafka/pull/19168
PR description updated successfully!
```
##########
committer-tools/reviewers.py:
##########
@@ -35,6 +37,31 @@ 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", {})
+ print(f"The new PR body will be:\n{current_pr_body}{message}")
+ escaped_message = message.replace("<", "\\<").replace(">", "\\>")
+ updated_pr_body = f"{current_pr_body}{escaped_message}"
+ except subprocess.CalledProcessError as e:
+ print("Failed to retrieve PR description:", e.stderr)
+ return
+
+ choice = input(f"Update the body of {pr_title}? (y/n): ").strip().lower()
Review Comment:
Could you add `"` to `pr_title` - otherwise, it is a bit unreadable.
```
Update the body of KAFKA-18942: Add reviewers to PR body with
committer-tools? (y/n): y
```
--
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]