Skip to content

Commit 67fe15c

Browse files
committed
fix: only check commits from PR
1 parent 04a8ff6 commit 67fe15c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/workflows/commitlint.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
with:
15-
fetch-depth:
16-
ref: ${{ github.event.pull_request.head.ref }} # Checkout the branch of the PR.
17-
repository: ${{ github.event.pull_request.head.repo.full_name }} # Handles forks.
15+
fetch-depth: 0
1816

1917
- name: Setup Python
2018
uses: actions/setup-python@v5
@@ -26,5 +24,11 @@ jobs:
2624
python -m pip install --upgrade pip
2725
pip install -r cz-requirement.txt
2826
27+
- name: Get base and head commits
28+
id: commits
29+
run: |
30+
echo "BASE_SHA=$(git merge-base origin/${{ github.event.pull_request.base.ref }} HEAD)" >> $GITHUB_ENV
31+
echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
32+
2933
- name: Check commit history
30-
run: cz check --rev-range $(git rev-list --all --reverse | head -1)..HEAD
34+
run: cz check --rev-range $BASE_SHA..$HEAD_SHA

0 commit comments

Comments
 (0)