From 16b219440d25884595dcf7ee5d00094aee1ec230 Mon Sep 17 00:00:00 2001 From: Bernhard Kaindl Date: Wed, 30 Oct 2024 12:00:00 +0000 Subject: [PATCH] review_pr(): show and the link to the PR before review --- cli/check.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cli/check.py b/cli/check.py index a6d6234..430405e 100755 --- a/cli/check.py +++ b/cli/check.py @@ -1899,13 +1899,26 @@ def review_pr(args: argparse.Namespace, kind: str, build_results: str) -> ExitCo if args.login: get_github_user(args) + print("Current GitHub CLI login:", args.github_user) + print("Requested GitHub CLI login:", args.login) if args.github_user != args.login: spawn("gh", ["auth", "switch", "--user", args.login]) + # View the PR to get the latest comments and reviews: + spawn("gh", ["pr", "view", args.pull_request]) + print("Link to the PR:", args.pull_request_url) + print("Submitting the result as review comment to the PR:", args.pull_request_url) + time.sleep(1) + + # Remove color terminal codes from the output: build_results = remove_color_terminal_codes(build_results) cmd = ["pr", "review", args.pull_request, kind, "--body", build_results] - return spawn("gh", cmd, show_command=False) + time.sleep(1) + exitcode = spawn("gh", cmd, show_command=False) + print("Link to the PR:", args.pull_request_url) + time.sleep(1) + return exitcode def extract_reviews_by_category(args: argparse.Namespace) -> bool: