Skip to content

Commit 0feaba2

Browse files
CodeCasterXclaude
andcommitted
docs(contributing): 更新提交规范并新增 PR 标题检查
- 更新 CONTRIBUTING.md 采用 Conventional Commits 规范 - 新增 GitHub Action 自动检查 PR 标题格式 - 支持 feat/fix/docs/refactor 等类型,scope 可选 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 59d424f commit 0feaba2

File tree

2 files changed

+65
-4
lines changed

2 files changed

+65
-4
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: PR Title Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize]
6+
7+
permissions:
8+
pull-requests: read
9+
10+
jobs:
11+
validate:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: amannn/action-semantic-pull-request@v5.5.2
15+
with:
16+
# 允许的提交类型
17+
types: |
18+
feat
19+
fix
20+
docs
21+
style
22+
refactor
23+
perf
24+
test
25+
chore
26+
build
27+
ci
28+
revert
29+
30+
# 不限制 scope,允许任意模块名
31+
# requireScope: false - scope 是可选的
32+
33+
# 标题描述长度 5-100 字符
34+
subjectPattern: '^.{5,100}$'
35+
subjectPatternError: '标题描述长度应在 5-100 字符之间'
36+
37+
# 禁用首字母大写检查(兼容中文)
38+
enforceSingleSentence: false
39+
40+
# 支持 WIP 前缀标记进行中的工作
41+
wip: true
42+
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CONTRIBUTING.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,27 @@ exec git-hooks/check-utf8-encoding.sh
8686
8787
### 提交信息格式
8888

89-
- 用简短的语句描述提交的主要内容,不要太长,建议 20 个字以内,需要使用中文,结尾不需要句号。
90-
- 如有必要,在简短的描述后添加一个空行,然后补充详细说明,可以使用多行来描述。
91-
- 说明中可以包括问题的原因、解决方法和影响范围等。
92-
- 样例:`修复某问题`
89+
我们采用 [Conventional Commits](https://www.conventionalcommits.org/) 规范,格式如下:
90+
`<type>(<scope>): <subject>`
91+
92+
- **type(类型)**
93+
- `feat`: 新功能 (feature)
94+
- `fix`: 问题修复 (bug fix)
95+
- `docs`: 文档变更 (documentation)
96+
- `style`: 代码格式 (formatting, missing semi colons, etc; no code change)
97+
- `refactor`: 代码重构 (neither fixes a bug nor adds a feature)
98+
- `perf`: 性能优化 (performance)
99+
- `test`: 测试相关 (adding missing tests)
100+
- `chore`: 构建过程或辅助工具变动 (maintain)
101+
- **scope(范围/模块)**:对应项目模块名,如 `fit`, `waterflow`, `fel`, `framework`, `ohscript` 等。如果涉及多个模块或全局变动,可以使用 `*` 或留空。
102+
- **subject(描述)**:简短描述主要内容,建议 20 个字以内,需要使用中文,结尾不需要句号。
103+
104+
如有必要,在简短的描述后添加一个空行,然后补充详细说明,可以使用多行来描述(包括问题原因、解决方法和影响范围等)。
105+
106+
**样例:**
107+
- `feat(fit): 支持 HTTPS 双向认证`
108+
- `fix(waterflow): 修复调度引擎的空指针异常`
109+
- `docs(framework): 修正快速开始指南中的拼写错误`
93110

94111
## 代码审查
95112

0 commit comments

Comments
 (0)