From cc57bc937d99bc65974bb1149179408f5198dcd2 Mon Sep 17 00:00:00 2001 From: Venelin Date: Tue, 28 May 2024 14:27:15 +0300 Subject: [PATCH 1/2] Downstream checks: add show closed option --- scripts/downstream_checks.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/downstream_checks.py b/scripts/downstream_checks.py index cc56b70bd..36190cf11 100644 --- a/scripts/downstream_checks.py +++ b/scripts/downstream_checks.py @@ -105,8 +105,10 @@ def repo_actions_url(repo: str) -> str: def main(): ap = argparse.ArgumentParser() ap.add_argument("--hash", required=True) + ap.add_argument("--show-closed", action="store_true") args = ap.parse_args() c = args.hash + show_closed: bool = args.show_closed replaced_query = QUERY.replace("???", c) token = sp.check_output(["gh", "auth", "token"]).decode("utf-8").strip() @@ -122,10 +124,13 @@ def main(): provider_map[repo.removeprefix("pulumi-")] = True + sentinel_status = get_sentinel_status(pr_checks) + if closed: + if show_closed: + print("CLOSED", sentinel_status, url) continue - sentinel_status = get_sentinel_status(pr_checks) if sentinel_status == "SUCCESS": print("SUCCESS", url) sp.check_call(["gh", "pr", "close", url]) From c2d2617d3a18c2d3f72182abc2529a973aebbb4d Mon Sep 17 00:00:00 2001 From: Venelin Date: Tue, 28 May 2024 14:32:46 +0300 Subject: [PATCH 2/2] add only-failed flag --- scripts/downstream_checks.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/downstream_checks.py b/scripts/downstream_checks.py index 36190cf11..54a9ad418 100644 --- a/scripts/downstream_checks.py +++ b/scripts/downstream_checks.py @@ -106,9 +106,11 @@ def main(): ap = argparse.ArgumentParser() ap.add_argument("--hash", required=True) ap.add_argument("--show-closed", action="store_true") + ap.add_argument("--only-failed", action="store_true") args = ap.parse_args() c = args.hash show_closed: bool = args.show_closed + only_failed: bool = args.only_failed replaced_query = QUERY.replace("???", c) token = sp.check_output(["gh", "auth", "token"]).decode("utf-8").strip() @@ -126,16 +128,14 @@ def main(): sentinel_status = get_sentinel_status(pr_checks) - if closed: - if show_closed: - print("CLOSED", sentinel_status, url) - continue - if sentinel_status == "SUCCESS": - print("SUCCESS", url) - sp.check_call(["gh", "pr", "close", url]) + if not only_failed: + print("SUCCESS", url) + if not closed: + sp.check_call(["gh", "pr", "close", url]) else: - print(sentinel_status, url) + if not closed or show_closed: + print(sentinel_status, url) for missing_repo in {repo for repo in provider_map if not provider_map[repo]}: print("MISSING", repo_actions_url(missing_repo))