-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (29 loc) · 913 Bytes
/
commit-lint.yml
File metadata and controls
36 lines (29 loc) · 913 Bytes
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
34
35
36
name: Lint Commit Messages
on:
pull_request:
types: [opened, edited, reopened, synchronize]
permissions:
contents: read
pull-requests: read
jobs:
commitlint:
name: Lint Commit Messages
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install commitlint
run: |
npm install --save-dev @commitlint/cli@18.4.3 @commitlint/config-conventional@18.4.3
- name: Validate PR commits
run: |
# Get the base branch (usually main)
BASE_SHA=$(git merge-base origin/${{ github.base_ref }} HEAD)
# Lint all commits in the PR
npx commitlint --from $BASE_SHA --to HEAD --verbose