Skip to content

Commit b9c3c4f

Browse files
committed
github: apply commit msg check to all commits
1 parent a2b8d4c commit b9c3c4f

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

.github/automation/pr-title-check.py .github/automation/commit-msg-check.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# *******************************************************************************
44
# Copyright 2024 Arm Limited and affiliates.
5+
# Copyright 2024 Intel Corporation
56
# SPDX-License-Identifier: Apache-2.0
67
#
78
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,7 +19,7 @@
1819
# *******************************************************************************
1920

2021
import argparse
21-
22+
import subprocess
2223

2324
# * Ensuring the scopes end in colon and same level scopes are comma delimited.
2425
# TODO: Limit scopes to an acceptable list of tags.
@@ -61,12 +62,20 @@ def __numCharacterCheck(msg: str):
6162

6263
def main():
6364
parser = argparse.ArgumentParser()
64-
parser.add_argument("msg", help="Commit message to check.")
65+
parser.add_argument("head", help="Head commit of PR branch")
66+
parser.add_argument("base", help="Base commit of PR branch")
6567
args = parser.parse_args()
66-
msg: str = args.msg
67-
print(f"msg: {msg}")
68-
__numCharacterCheck(msg)
69-
__scopeCheck(msg)
68+
base: str = args.base
69+
head: str = args.head
70+
71+
commit_range = base + ".." + head
72+
messages = subprocess.run(["git", "rev-list", "--ancestry-path", commit_range, "--format=oneline"], capture_output=True, text=True).stdout
73+
74+
for i in messages.splitlines():
75+
commit_msg=i.split(' ', 1)[1]
76+
print(f"msg: {commit_msg}")
77+
__numCharacterCheck(commit_msg)
78+
__scopeCheck(commit_msg)
7079

7180

7281
if __name__ == "__main__":

.github/workflows/pr-check.yml .github/workflows/commit-msg-check.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# *******************************************************************************
22
# Copyright 2024 Arm Limited and affiliates.
3+
# Copyright 2024 Intel Corporation
34
# SPDX-License-Identifier: Apache-2.0
45
#
56
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,10 +25,16 @@ on:
2425
# Declare default permissions as read only.
2526
permissions: read-all
2627

28+
# Kill stale checks
29+
concurrency:
30+
group: ${{ github.ref }}
31+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
32+
2733
jobs:
2834
title:
35+
if: github.repository == 'oneapi-src/oneDNN'
2936
runs-on: ubuntu-latest
3037
steps:
3138
- uses: actions/checkout@v4
32-
- name: Pass pull request title through script.
33-
run: python3 ./.github/automation/pr-title-check.py "${{ github.event.pull_request.title }}"
39+
- name: Pass pull request commit messages through script.
40+
run: python3 ./.github/automation/commit-msg-check.py "${{ github.event.pull_request.head.sha }}" "${{ github.event.pull_request.base.sha }}"

0 commit comments

Comments
 (0)