-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (28 loc) · 1.12 KB
/
commitlint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
name: Conventional Commits
on:
push:
pull_request:
types: [opened, synchronize, reopened, edited]
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/workflows/composites/install_node_things/
- name: Determine if merge commit
id: merge
run: |
isMerge=$(git show --pretty=%P -s HEAD | grep -q ' ' && echo true || echo false)
echo "isMerge=$isMerge" >> $GITHUB_OUTPUT
- name: Lint all commits in push event
if: github.event_name == 'push' && steps.merge.outputs.isMerge == 'false'
env:
commitsJson: ${{ toJson(github.event.commits) }}
run: |
commitCount=$(echo "$commitsJson" | jq length)
pnpm exec commitlint --from HEAD~$commitCount --to HEAD --verbose
- name: Lint all commits in pull request
if: github.event_name == 'pull_request'
run: pnpm exec commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose