MINOR: Improve the prompt in committer-tools/reviewers.py (#19942)

Previously, the confirmation prompt for updating the PR body treated any
input other than 'n' as approval, which could lead to unintended
actions.

With this change, the update will only proceed if the user enters 'y',
'Y', or presses Enter. For any other input, the operation is canceled
and an Abort. message is printed. This makes the prompt behavior clearer
and more predictable.

Reviewers: TengYao Chi <frankvicky@apache.org>, PoAn Yang
<payang@apache.org>, Kuan-Po Tseng <brandboat@gmail.com>, Ken Huang
<s7133700@gmail.com>, Lan Ding <isDing_L@163.com>
This commit is contained in:
Ming-Yen Chung 2025-06-10 17:37:57 +08:00 committed by GitHub
parent 793dcee541
commit 472c2cfcb4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -63,8 +63,9 @@ def append_message_to_pr_body(pr: int , message: str):
return return
print(f"""New PR body will be:\n\n---\n{updated_pr_body}---\n""") print(f"""New PR body will be:\n\n---\n{updated_pr_body}---\n""")
choice = input(f'Update the body of "{pr_title}"? (y/n): ').strip().lower() choice = input(f'Update the body of "{pr_title}"? [Y/n] ').strip().lower()
if choice in ['n', 'no']: if choice not in ['', 'y']:
print("Abort.")
return return
try: try: