diff --git a/.github/workflows/handle_potential_conflicts.py b/.github/workflows/handle_potential_conflicts.py old mode 100644 new mode 100755 index bd4232752f..c669685ac6 --- a/.github/workflows/handle_potential_conflicts.py +++ b/.github/workflows/handle_potential_conflicts.py @@ -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 # file COPYING or http://www.opensource.org/licenses/mit-license.php. + +""" + +Usage: + $ ./handle_potential_conflicts.py + +Where is a json string which looks like + { pull_number: 26, + conflictPrs: + [ { number: 15, + files: [ 'testfile1', `testfile2` ], + conflicts: [ 'testfile1' ] }, + ... + ]} +""" + import sys import requests # need to install via pip import hjson -'''Looks like''' -'''{ pull_number: 26, - conflictPrs: - [ { number: 25, - files: [ '.github/workflows/testfile' ], - conflicts: [ '.github/workflows/testfile' ] } - { number: 24, - files: [ '.github/workflows/testfile' ], - conflicts: [ '.github/workflows/testfile' ] } ] }''' +def get_label(pr_num): + return requests.get(f'https://api.github.com/repos/dashpay/dash/pulls/{pr_num}').json()['head']['label'] def main(): + if len(sys.argv) != 2: + print(f'Usage: {sys.argv[0]} ', file=sys.stderr) + sys.exit(1) + input = sys.argv[1] print(input) j_input = hjson.loads(input) @@ -58,10 +72,5 @@ def main(): 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__": main() diff --git a/.github/workflows/predict-conflicts.yml b/.github/workflows/predict-conflicts.yml index 45969660b0..ab364d65a7 100644 --- a/.github/workflows/predict-conflicts.yml +++ b/.github/workflows/predict-conflicts.yml @@ -21,8 +21,10 @@ jobs: runs-on: ubuntu-latest steps: - name: check for potential conflicts - uses: PastaPastaPasta/potential-conflicts-checker-action@0.1.9 + uses: PastaPastaPasta/potential-conflicts-checker-action@v0.1.10 with: ghToken: "${{ secrets.GITHUB_TOKEN }}" + - name: Checkout + uses: actions/checkout@v2 - 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"