-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (43 loc) · 1.4 KB
/
commitlint.yml
File metadata and controls
53 lines (43 loc) · 1.4 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Commit checks
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: commitlint-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
commitlint:
if: >-
(github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]')
|| (github.event_name == 'push' && github.event.head_commit.author.name != 'dependabot[bot]')
runs-on: ubuntu-latest
steps:
- name: Enforce single-commit PRs
if: github.event_name == 'pull_request'
env:
PR_COMMIT_COUNT: ${{ github.event.pull_request.commits }}
run: |
test "$PR_COMMIT_COUNT" -eq 1
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: "22"
- name: Install commitlint
run: npm install -D @commitlint/cli @commitlint/config-conventional
- name: Validate PR title
if: github.event_name == 'pull_request'
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
printf '%s\n' "$PR_TITLE" | npx commitlint --verbose
- name: Validate last commit
run: |
npx commitlint --last --verbose