-
Notifications
You must be signed in to change notification settings - Fork 1
40 lines (33 loc) · 1011 Bytes
/
check-commits.yml
File metadata and controls
40 lines (33 loc) · 1011 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
37
38
39
40
name: "📜 Check Commit Messages"
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
branches:
- "main"
permissions:
contents: read
jobs:
check-commit-messages:
runs-on: ubuntu-latest
steps:
- name: "⏳ Checkout repository"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "🟢 Set up Node.js"
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- name: "🛠 Install commitlint"
run: npm ci --ignore-scripts
- name: "📜 Validate commit messages"
run: npx --no-install commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
- name: "📜 Validate PR title (used as squash commit message)"
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: printf '%s\n' "$PR_TITLE" | npx --no-install commitlint --verbose