Skip to content

Commit 41f1bd4

Browse files
authored
Merge pull request #9 from Rasic2/dev/zhouh
chore: improve PR labeling accuracy, update git documentation, and standardize release labels
2 parents c3e79f8 + 00df12e commit 41f1bd4

3 files changed

Lines changed: 20 additions & 11 deletions

File tree

.github/release-drafter.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ categories:
1717
- title: 'Maintenance'
1818
label: 'maintenance'
1919
- title: 'Documentation'
20-
label: 'docs'
20+
label: 'documentation'
2121
- title: 'Other changes'
2222
- title: 'Dependency Updates'
2323
label: 'dependencies'
@@ -34,7 +34,7 @@ version-resolver:
3434
labels:
3535
- 'bug'
3636
- 'maintenance'
37-
- 'docs'
37+
- 'documentation'
3838
- 'dependencies'
3939
- 'security'
4040

.github/workflows/pr-auto-label.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Auto Label by Title'
1+
name: "Auto Label by Title"
22

33
on:
44
pull_request:
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
# 添加权限配置
1414
permissions:
15-
issues: write # 或者 contents: write
15+
issues: write # 或者 contents: write
1616
pull-requests: write
1717
steps:
1818
- name: Label PR based on title keywords
@@ -37,13 +37,20 @@ jobs:
3737
'dependabot': 'dependencies',
3838
'upgrade': 'dependencies',
3939
'security': 'security',
40-
'ci':'ci'
40+
'ci': 'ci'
4141
};
4242
43-
// 检查标题是否包含关键词
44-
for (const [keyword, label] of Object.entries(keywordMap)) {
45-
if (title.includes(keyword)) {
46-
labelsToAdd.add(label);
43+
// 提取标题的第一个单词(冒号前的部分)
44+
const firstPart = title.split(':')[0].trim();
45+
const words = firstPart.split(/\s+/); // 分割成单词数组
46+
47+
// 检查第一个单词或前缀是否匹配关键词
48+
for (const word of words) {
49+
const normalizedWord = word.toLowerCase().replace(/^[\W_]+|[\W_]+$/g, '');
50+
51+
if (keywordMap.hasOwnProperty(normalizedWord)) {
52+
labelsToAdd.add(keywordMap[normalizedWord]);
53+
break; // 找到第一个匹配就停止
4754
}
4855
}
4956

docs/source/development/git.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ git log --stat # 查看所有提交记录的修改文件信息
227227
git log -p file # 查看某个文件的修改历史
228228
git log COMMIT1..COMMIT2 -- file # 查看某个文件从 COMMIT1 到COMMIT2 所有的修改情况(概略信息)
229229
git log COMMIT1..COMMIT2 -p file # 查看某个文件从 COMMIT1 到COMMIT2 所有的修改情况(详细信息)
230+
git log -n 4 --pretty=format:"%s" # 查看最近4条提交记录并只显示提交信息
230231
```
231232

232233
- 合并分支(变基)
@@ -555,10 +556,11 @@ oco config set OCO_AI_PROVIDER='azure' OCO_MODEL='gpt-4o'
555556
oco config set OCO_API_KEY=xxx
556557
```
557558

558-
3.可选】关闭自动 push
559+
3.可选配置】
559560

560561
```bash
561-
oco config set OCO_GITPUSH=false
562+
oco config set OCO_GITPUSH=false # 关闭自动 push
563+
oco config set OCO_ONE_LINE_COMMIT=true # 单行 commit
562564
```
563565

564566
4. 使用 oco 命令生成 commit

0 commit comments

Comments
 (0)