diff --git a/advisors/review_tool.py b/advisors/review_tool.py index dccb2703bf3ceba8ad48f62930ea62925ddab5a7..3925fa462f72c4f69031ff4a59df81e430adb812 100755 --- a/advisors/review_tool.py +++ b/advisors/review_tool.py @@ -603,6 +603,7 @@ def prepare_env(work_dir, reuse, pr_tuple, branch): gitee_url = "https://gitee.com/{repo}.git".format(repo=repo) local_path = os.path.join(work_dir, local_repo_name(group, repo_name, pull_id)) if os.path.exists(local_path) and not reuse: + print("WARNING: %s already exist, delete it." % local_path) shutil.rmtree(local_path) if not os.path.exists(local_path): if exec_cmd(["git", "clone", gitee_url, local_path]) != 0: diff --git a/prow/prow_review_tool b/prow/prow_review_tool index 5334408774cecf50cb4bfcec7e4d3ce0c096bf76..40ec9ce9db9d36f1e1e88d84595e11a798f48369 100755 --- a/prow/prow_review_tool +++ b/prow/prow_review_tool @@ -63,19 +63,23 @@ if __name__ == '__main__': return_code = subp.returncode elif args.event == 'Note Hook' and data['action'] == 'comment' \ and data['noteable_type'] == 'PullRequest': - if not data['comment']['body'].startswith("/review"): + if not data['comment']['body'].startswith("/review "): sys.exit(2) + sets_li = [] for line in data['comment']['body'].splitlines(): - if line.strip().startswith("/review"): - args = line.strip().split(' ', 1) - content = args[1] - subp = subprocess.run(["python3", get_cmd(), - "-u", data['pull_request']['html_url'], "-e", content], - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - encoding="utf-8", - check=False) - return_code = subp.returncode + if line.strip().startswith("/review "): + sets = line.strip().split(maxsplit=1)[1] + sets_li.append(sets) + contents = " ".join(sets_li) + if not contents: + sys.exit(2) + subp = subprocess.run(["python3", get_cmd(), + "-u", data['pull_request']['html_url'], "-e", contents], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + encoding="utf-8", + check=False) + return_code = subp.returncode else: print("prow_review_tool: this action type not need to process.") if return_code != 0: