mingyen066 commented on code in PR #19168:
URL: https://github.com/apache/kafka/pull/19168#discussion_r1988290418


##########
committer-tools/reviewers.py:
##########
@@ -35,6 +39,41 @@ def prompt_for_user():
             return clean_input
 
 
+def update_trailers(body, trailer):
+    with tempfile.NamedTemporaryFile() as fp:
+        fp.write(body.encode())
+        fp.flush()
+        cmd = f"git interpret-trailers --if-exists replace --trailer 
'{trailer}' {fp.name} "
+        p = subprocess.run(shlex.split(cmd), capture_output=True, text=True)
+        fp.close()
+
+    return p.stdout
+
+
+def append_message_to_pr_body(pr: int , message: str):
+    try:
+        pr_url = f"https://github.com/apache/kafka/pull/{pr}";
+        cmd_get_pr = shlex.split(f"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", {})
+        updated_pr_body = update_trailers(current_pr_body, message)
+    except subprocess.CalledProcessError as e:
+        print("Failed to retrieve PR body:", e.stderr)
+        return
+

Review Comment:
   Updated! You can see the example in pr body.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to