From 9ad537380be3157c73366916023a94ebbd165aa1 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Wed, 4 Sep 2024 23:06:34 +0300 Subject: [PATCH] ci: less api calls when checking potential conflicts --- .github/workflows/handle_potential_conflicts.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/handle_potential_conflicts.py b/.github/workflows/handle_potential_conflicts.py index f7c2cbe93f..442447ae43 100755 --- a/.github/workflows/handle_potential_conflicts.py +++ b/.github/workflows/handle_potential_conflicts.py @@ -27,9 +27,6 @@ import hjson def get_label(pr_num): return requests.get(f'https://api.github.com/repos/dashpay/dash/pulls/{pr_num}').json()['head']['label'] -def is_draft(pr_num): - return requests.get(f'https://api.github.com/repos/dashpay/dash/pulls/{pr_num}').json()['draft'] - def main(): if len(sys.argv) != 2: print(f'Usage: {sys.argv[0]} ', file=sys.stderr) @@ -60,11 +57,11 @@ def main(): print(f'{this_pr_num} needs rebase. Skipping conflict check') continue - if is_draft(this_pr_num): + if r.json()["draft"]: print(f'{this_pr_num} is a draft. Skipping conflict check') continue - r = requests.get(f'https://github.com/dashpay/dash/branches/pre_mergeable/{our_pr_label}...{get_label(this_pr_num)}') + r = requests.get(f'https://github.com/dashpay/dash/branches/pre_mergeable/{our_pr_label}...{r.json()['head']['label']}') if "These branches can be automatically merged." in r.text: good.append(this_pr_num) elif "Can’t automatically merge" in r.text: