forked from xixu-me/xget
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (46 loc) · 1.27 KB
/
commitlint.yml
File metadata and controls
54 lines (46 loc) · 1.27 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: Commit Lint
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
commitlint:
name: Validate Commit Messages
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' && !startsWith(github.head_ref, 'dependabot/') }}
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Lint commit messages
shell: bash
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
FROM="${{ github.event.pull_request.base.sha }}"
TO="${{ github.event.pull_request.head.sha }}"
else
FROM="${{ github.event.before }}"
TO="${{ github.sha }}"
fi
if [[ "$FROM" == "0000000000000000000000000000000000000000" ]]; then
npx commitlint --last --verbose
else
npx commitlint --from "$FROM" --to "$TO" --verbose
fi