mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
chore/feat: few tweaks for "Check Potential Conflicts" action (#5330)
## Issue being fixed or feature implemented small cleanups and improvements ## What was done? pls see individual commits ## How Has This Been Tested? see https://github.com/dashpay/dash/actions/runs/4715728701/jobs/8362893373?pr=5330 ## Breaking Changes n/a ## 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)_
This commit is contained in:
parent
47e45810a9
commit
a91eace041
39
.github/workflows/handle_potential_conflicts.py
vendored
Normal file → Executable file
39
.github/workflows/handle_potential_conflicts.py
vendored
Normal file → Executable file
@ -1,23 +1,37 @@
|
|||||||
# Copyright (c) 2022 The Dash Core developers
|
#!/usr/bin/env python3
|
||||||
|
# Copyright (c) 2022-2023 The Dash Core developers
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
$ ./handle_potential_conflicts.py <conflicts>
|
||||||
|
|
||||||
|
Where <conflicts> is a json string which looks like
|
||||||
|
{ pull_number: 26,
|
||||||
|
conflictPrs:
|
||||||
|
[ { number: 15,
|
||||||
|
files: [ 'testfile1', `testfile2` ],
|
||||||
|
conflicts: [ 'testfile1' ] },
|
||||||
|
...
|
||||||
|
]}
|
||||||
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
# need to install via pip
|
# need to install via pip
|
||||||
import hjson
|
import hjson
|
||||||
|
|
||||||
'''Looks like'''
|
def get_label(pr_num):
|
||||||
'''{ pull_number: 26,
|
return requests.get(f'https://api.github.com/repos/dashpay/dash/pulls/{pr_num}').json()['head']['label']
|
||||||
conflictPrs:
|
|
||||||
[ { number: 25,
|
|
||||||
files: [ '.github/workflows/testfile' ],
|
|
||||||
conflicts: [ '.github/workflows/testfile' ] }
|
|
||||||
{ number: 24,
|
|
||||||
files: [ '.github/workflows/testfile' ],
|
|
||||||
conflicts: [ '.github/workflows/testfile' ] } ] }'''
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
print(f'Usage: {sys.argv[0]} <conflicts>', file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
input = sys.argv[1]
|
input = sys.argv[1]
|
||||||
print(input)
|
print(input)
|
||||||
j_input = hjson.loads(input)
|
j_input = hjson.loads(input)
|
||||||
@ -58,10 +72,5 @@ def main():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_label(pr_num):
|
|
||||||
return requests.get(f'https://api.github.com/repos/dashpay/dash/pulls/{pr_num}').json()['head']['label']
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
6
.github/workflows/predict-conflicts.yml
vendored
6
.github/workflows/predict-conflicts.yml
vendored
@ -21,8 +21,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: check for potential conflicts
|
- name: check for potential conflicts
|
||||||
uses: PastaPastaPasta/potential-conflicts-checker-action@0.1.9
|
uses: PastaPastaPasta/potential-conflicts-checker-action@v0.1.10
|
||||||
with:
|
with:
|
||||||
ghToken: "${{ secrets.GITHUB_TOKEN }}"
|
ghToken: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
- name: validate potential conflicts
|
- name: validate potential conflicts
|
||||||
run: wget https://raw.githubusercontent.com/dashpay/dash/develop/.github/workflows/handle_potential_conflicts.py && pip3 install hjson && python3 handle_potential_conflicts.py "$conflicts"
|
run: pip3 install hjson && .github/workflows/handle_potential_conflicts.py "$conflicts"
|
||||||
|
Loading…
Reference in New Issue
Block a user