Skip to content

Commit 76ded09

Browse files
committed
ci: ensure that all the commits are linted by pre-commit hook
This commit ensures that all the commits are linted by pre-commit hook in a PR. Signed-off-by: vprashar2929 <[email protected]>
1 parent 0d0ca5f commit 76ded09

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

.github/workflows/pr-checks.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
- name: Checkout source
109109
uses: actions/checkout@v3
110110
with:
111-
ref: ${{ github.event.pull_request.head.sha }}
111+
fetch-depth: 0 # Fetch all the history of PR commits
112112

113113
- name: Setup Python
114114
uses: actions/setup-python@v3
@@ -121,9 +121,10 @@ jobs:
121121

122122
- name: Run Commitlint
123123
run: |
124-
COMMIT_MSG=$(git log -1 --pretty=%B)
125-
echo "$COMMIT_MSG" > .git/COMMIT_EDITMSG
126-
pre-commit run commitlint --hook-stage commit-msg --commit-msg-file .git/COMMIT_EDITMSG
124+
# Get all the commits between the base and head refs
125+
pre-commit run commitlint --hook-stage commit-msg --from-ref ${{ github.event.pull_request.base.sha }} \
126+
--to-ref ${{ github.event.pull_request.head.sha }} --verbose \
127+
--commit-msg-filename ""
127128
128129
build-images:
129130
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)