File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 22
33on :
44 push :
5- pull_request :
5+ pull_request_target :
6+ types : [opened, reopened, synchronize]
67
78concurrency :
89 group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1415
1516jobs :
1617 commitlint :
17- if : github.event_name == 'pull_request'
18- env :
19- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
18+ if : github.event_name == 'pull_request_target'
2019 runs-on : ubuntu-latest
2120 steps :
2221 - uses : actions/checkout@v4
2322 with :
2423 fetch-depth : 0
2524 - name : Run commitlint
2625 run : |
27- commit=$(gh api \
28- /repos/ ${{ github.repository }}/pulls/${{github. event.number}}/commits \
29- | jq -r '.[0].commit.message' \
30- | head -n 1 )
26+ base_sha="${{ github.event.pull_request.base.sha }}"
27+ head_sha=" ${{ github.event.pull_request.head.sha }}"
28+ first_commit_sha=$(git rev-list --no-merges --reverse $base_sha..$head_sha | head -n 1)
29+ commit_message=$(git log -1 --pretty=%B $first_commit_sha )
3130 # we can't use npx see https://github.com/conventional-changelog/commitlint/issues/613
3231 echo '{}' > package.json
3332 npm install --no-fund --no-audit @commitlint/config-conventional @commitlint/cli
34- echo $commit | ./node_modules/.bin/commitlint -g .commitlintrc
33+ echo "$commit_message" | ./node_modules/.bin/commitlint -g .commitlintrc
3534
3635 architecture :
3736 name : Check components interdependencies
You can’t perform that action at this time.
0 commit comments