-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (47 loc) · 1.67 KB
/
Copy pathcommitlint.yml
File metadata and controls
56 lines (47 loc) · 1.67 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
55
56
name: Commitlint
on:
push:
branches:
- "**"
pull_request:
types:
- opened
- synchronize
- reopened
permissions:
contents: read
# 同一 ref 只保留一组在途运行;PR 上新 push 取消旧运行
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
commitlint:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: 安装 pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- name: 安装 Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
cache: pnpm
- name: 安装前端依赖
run: pnpm install --frozen-lockfile
- name: 检查 Push 提交信息
if: github.event_name == 'push'
run: |
set -euo pipefail
from="${{ github.event.before }}"
to="${{ github.event.after }}"
if [ "$from" = "0000000000000000000000000000000000000000" ]; then
git fetch origin "${{ github.event.repository.default_branch }}"
from="$(git merge-base "origin/${{ github.event.repository.default_branch }}" "$to")"
fi
pnpm exec commitlint --from "$from" --to "$to" --verbose
- name: 检查 Pull Request 提交信息
if: github.event_name == 'pull_request'
run: pnpm exec commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose