mingyen066 commented on code in PR #19168: URL: https://github.com/apache/kafka/pull/19168#discussion_r1986334149
########## 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: That's because I print the PR body to the console. The upper is the PR body message, the below is message output by the tool. After I remove the debug message, there is no duplicated. -- 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