Request labels from gh api for validate bugfix check

This commit is contained in:
vdimir 2022-10-27 10:49:02 +00:00 committed by Vladimir C
parent e0735e1e67
commit 9f5dcd14af
2 changed files with 8 additions and 11 deletions

View File

@ -211,7 +211,8 @@ if __name__ == "__main__":
run_changed_tests = flaky_check or validate_bugix_check
gh = Github(get_best_robot_token(), per_page=100)
pr_info = PRInfo(need_changed_files=run_changed_tests)
# For validate_bugix_check we need up to date information about labels, so pr_event_from_api is used
pr_info = PRInfo(need_changed_files=run_changed_tests, pr_event_from_api=validate_bugix_check)
atexit.register(update_mergeable_check, gh, pr_info, check_name)
@ -227,13 +228,7 @@ if __name__ == "__main__":
"null",
)
logging.info("Skipping '%s' (no pr-bugfix in %s)", check_name, pr_info.labels)
# >>>>
time.sleep(10)
pr_info = PRInfo(need_changed_files=run_changed_tests)
logging.info("pr_info '%s' (%s)", pr_info, pr_info.labels)
sys.exit(1)
# <<<<
sys.exit(0)
if "RUN_BY_HASH_NUM" in os.environ:
run_by_hash_num = int(os.getenv("RUN_BY_HASH_NUM"))

View File

@ -167,17 +167,19 @@ if __name__ == "__main__":
os.makedirs(temp_path)
is_flaky_check = "flaky" in check_name
pr_info = PRInfo(need_changed_files=is_flaky_check or validate_bugix_check)
# For validate_bugix_check we need up to date information about labels, so pr_event_from_api is used
pr_info = PRInfo(need_changed_files=is_flaky_check or validate_bugix_check, pr_event_from_api=validate_bugix_check)
if validate_bugix_check and "pr-bugfix" not in pr_info.labels:
if args.post_commit_status == "file":
post_commit_status_to_file(
os.path.join(temp_path, "post_commit_status.tsv"),
"Skipped (no pr-bugfix)",
f"Skipped (no pr-bugfix in {pr_info.labels})",
"success",
"null",
)
logging.info("Skipping '%s' (no pr-bugfix)", check_name)
logging.info("Skipping '%s' (no pr-bugfix in '%s')", check_name, pr_info.labels)
sys.exit(0)
gh = Github(get_best_robot_token(), per_page=100)