mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge #6249: ci: improve conflicts checker to skip PRs which are a draft
2e8f9f9f08
refactor: better readability (UdjinM6)9ad537380b
ci: less api calls when checking potential conflicts (UdjinM6)9f3d5b08c7
ci: improve conflicts checker to skip PRs which are a draft (pasta) Pull request description: ## Issue being fixed or feature implemented Currently, CI will report a lot of conflicts on most normal PRs. This is because a lot of times a WIP PR will be opened which depends on another. This will result in both being unhappy. ## What was done? Instead, skip any PR which is considered a draft. ## How Has This Been Tested? Hasn't, wish us luck! ## Breaking Changes None ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK2e8f9f9f08
Tree-SHA512: 3c498d406244bf288df21dc57b28120d2f50c409c1cf1311e3681647bc76d435910e7bb81e9bf6441c057644602324b8be451e66a9fc19a28be30100a7c70087
This commit is contained in:
commit
8c106bb9ce
34
.github/workflows/handle_potential_conflicts.py
vendored
34
.github/workflows/handle_potential_conflicts.py
vendored
@ -24,8 +24,8 @@ import requests
|
||||
# need to install via pip
|
||||
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 get_pr_json(pr_num):
|
||||
return requests.get(f'https://api.github.com/repos/dashpay/dash/pulls/{pr_num}').json()
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
@ -39,29 +39,33 @@ def main():
|
||||
|
||||
|
||||
our_pr_num = j_input['pull_number']
|
||||
our_pr_label = get_label(our_pr_num)
|
||||
our_pr_label = get_pr_json(our_pr_num)['head']['label']
|
||||
conflictPrs = j_input['conflictPrs']
|
||||
|
||||
good = []
|
||||
bad = []
|
||||
|
||||
for conflict in conflictPrs:
|
||||
this_pr_num = conflict['number']
|
||||
print(this_pr_num)
|
||||
conflict_pr_num = conflict['number']
|
||||
print(conflict_pr_num)
|
||||
|
||||
r = requests.get(f'https://api.github.com/repos/dashpay/dash/pulls/{this_pr_num}')
|
||||
print(r.json()['head']['label'])
|
||||
conflict_pr_json = get_pr_json(conflict_pr_num)
|
||||
conflict_pr_label = conflict_pr_json['head']['label']
|
||||
print(conflict_pr_label)
|
||||
|
||||
mergable_state = r.json()['mergeable_state']
|
||||
if mergable_state == "dirty":
|
||||
print(f'{this_pr_num} needs rebase. Skipping conflict check')
|
||||
if conflict_pr_json['mergeable_state'] == "dirty":
|
||||
print(f'{conflict_pr_num} needs rebase. Skipping conflict check')
|
||||
continue
|
||||
|
||||
r = requests.get(f'https://github.com/dashpay/dash/branches/pre_mergeable/{our_pr_label}...{get_label(this_pr_num)}')
|
||||
if "These branches can be automatically merged." in r.text:
|
||||
good.append(this_pr_num)
|
||||
elif "Can’t automatically merge" in r.text:
|
||||
bad.append(this_pr_num)
|
||||
if conflict_pr_json['draft']:
|
||||
print(f'{conflict_pr_num} is a draft. Skipping conflict check')
|
||||
continue
|
||||
|
||||
pre_mergeable = requests.get(f'https://github.com/dashpay/dash/branches/pre_mergeable/{our_pr_label}...{conflict_pr_label}')
|
||||
if "These branches can be automatically merged." in pre_mergeable.text:
|
||||
good.append(conflict_pr_num)
|
||||
elif "Can’t automatically merge" in pre_mergeable.text:
|
||||
bad.append(conflict_pr_num)
|
||||
else:
|
||||
raise Exception("not mergeable or unmergable!")
|
||||
|
||||
|
2
.github/workflows/predict-conflicts.yml
vendored
2
.github/workflows/predict-conflicts.yml
vendored
@ -19,7 +19,7 @@ permissions:
|
||||
statuses: none
|
||||
|
||||
jobs:
|
||||
main:
|
||||
predict_conflicts:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check for potential conflicts
|
||||
|
Loading…
Reference in New Issue
Block a user