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:
12
12
- uses : actions/checkout@v4
13
13
with :
14
14
fetch-depth : 0
15
+ - name : Fetch PR head
16
+ run : git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_head
15
17
- name : Run commitlint
16
18
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
+
20
27
commit_message=$(git log -1 --pretty=%B $first_commit_sha)
21
28
# we can't use npx see https://github.com/conventional-changelog/commitlint/issues/613
22
29
echo '{}' > package.json
You can’t perform that action at this time.
0 commit comments