Skip to content

Commit 7d9fca7

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 600aa3d commit 7d9fca7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/workflows/pr-checks.yaml

Lines changed: 3 additions & 3 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,8 +121,8 @@ jobs:
121121

122122
- name: Run Commitlint
123123
run: |
124-
COMMIT_MSG=$(git log -1 --pretty=%B)
125-
echo "$COMMIT_MSG" > .git/COMMIT_EDITMSG
124+
# Get all the commits between the base and head refs
125+
git log --pretty=%B ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | tee .git/COMMIT_EDITMSG
126126
pre-commit run commitlint --hook-stage commit-msg --commit-msg-file .git/COMMIT_EDITMSG
127127
128128
build-images:

0 commit comments

Comments
 (0)