diff --git a/.github/workflows/check_commit_style.py b/.github/workflows/check_commit_style.py index e0805d298..06fb69bcb 100755 --- a/.github/workflows/check_commit_style.py +++ b/.github/workflows/check_commit_style.py @@ -19,6 +19,14 @@ def cmd(args): def main(): + targetBranch = "" + if len(sys.argv) > 1: + targetBranch = sys.argv[1] + else: + raise RuntimeError("Target branch not specified!") + + print("Checking commit styles - target branch: \"{}\"".format(targetBranch)) + try: # Set up remote remoteName = "mumble-upstream" @@ -28,7 +36,7 @@ def main(): cmd(["git", "fetch", "--no-recurse-submodules", remoteName]) # get new commits - commitHashes = [x for x in cmd(["git", "rev-list", "{}/master..HEAD".format(remoteName)]).split("\n") if x] + commitHashes = [x for x in cmd(["git", "rev-list", "{}/{}..HEAD".format(remoteName, targetBranch)]).split("\n") if x] # Reverse the order of the commits so that oldest comes first commitHashes.reverse() diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index db10f54ae..9d9bd329e 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -21,7 +21,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: Check commit style - run: $GITHUB_WORKSPACE/.github/workflows/check_commit_style.py + run: $GITHUB_WORKSPACE/.github/workflows/check_commit_style.py ${{ github.base_ref }} shell: bash - name: Check line endings