-
-
Notifications
You must be signed in to change notification settings - Fork 8
54 lines (46 loc) 路 1.66 KB
/
Copy pathcommitlint.yml
File metadata and controls
54 lines (46 loc) 路 1.66 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
54
name: Commitlint
on:
push:
branches:
- 'push-action/**'
pull_request:
types: [opened, edited, synchronize, reopened]
concurrency:
group: commitlint-${{ github.ref }}
cancel-in-progress: true
jobs:
lint-commits:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 22
# commitlint v21 requires Node >= 22.12; resolve the latest 22.x
# instead of trusting a possibly stale runner toolcache.
check-latest: true
# Pin the commitlint major version: `npx commitlint` resolves the locally
# installed CLI instead of pulling the latest release, whose Node
# requirement may outgrow the version pinned above.
- name: Install commitlint
run: |
npm install @commitlint/cli@21 @commitlint/config-conventional@21
- name: Create commitlint config file
run: |
cat <<EEE > commitlint.config.mjs
export default {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [2, 'always', ['feat', 'fix', 'refactor', 'test', 'ci', 'chore', 'docs', 'revert', 'release']],
'scope-enum': [2, 'always', ['core', 'android-sdk', 'android-sample', 'deps']],
},
};
EEE
- name: Commitlint
run: npx commitlint --from HEAD~${{ github.event.pull_request.commits }} --to HEAD
- name: Commitlint on PR title
run: echo '${{ github.event.pull_request.title }}' | npx commitlint