Skip to content

Commit

Permalink
ci: less api calls when checking potential conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 committed Sep 5, 2024
1 parent 9f3d5b0 commit 9ad5373
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/handle_potential_conflicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
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]} <conflicts>', file=sys.stderr)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 9ad5373

Please sign in to comment.