File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,18 @@ jobs:
1212 - uses : actions/checkout@v4
1313 with :
1414 fetch-depth : 0
15+ - name : Fetch PR head
16+ run : git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_head
1517 - name : Run commitlint
1618 run : |
17- base_sha="${{ github.event.pull_request.base.sha }}"
18- head_sha="${{ github.event.pull_request.head.sha }}"
19- first_commit_sha=$(git rev-list --no-merges --reverse $base_sha..$head_sha | head -n 1)
19+ merge_base_sha=$(git merge-base HEAD pr_head)
20+ first_commit_sha=$(git rev-list --no-merges --reverse $merge_base_sha..pr_head | head -n 1)
21+
22+ if [ -z "$first_commit_sha" ]; then
23+ echo "Could not determine the first commit of the PR. Skipping."
24+ exit 0
25+ fi
26+
2027 commit_message=$(git log -1 --pretty=%B $first_commit_sha)
2128 # we can't use npx see https://github.com/conventional-changelog/commitlint/issues/613
2229 echo '{}' > package.json
You can’t perform that action at this time.
0 commit comments