Skip to content

Commit

Permalink
chore: GIT commit message 提交规范 (closed TencentBlueKing#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyyalt committed Jan 26, 2024
1 parent e35ede4 commit 079fcf4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report_zh.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Bug反馈
about: 反馈Bug
title: "[BUG]"
title: "fix: "
labels: bug
assignees: zhangzhw8

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/enhancement.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: 需求、优化、建议
about: 需求、优化、建议
title: "[FEATURE]"
title: "feat: "
labels: feature
assignees: zhangzhw8

Expand Down
12 changes: 6 additions & 6 deletions .github/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
},
{
"title": "### 🚀 Features",
"labels": ["kind/feature", "feature", "feat(front)"]
"labels": ["kind/feature", "feature", "feat(front)", "feat"]
},
{
"title": "### ✨ Optimizations",
"labels": ["kind/optimization", "optimization", "perf(front)", "optimize(front)", "style(front)"]
"labels": ["kind/optimization", "optimization", "perf(front)", "optimize(front)", "style(front)", "style", "perf"]
},
{
"title": "### 🐛 Bugfixes",
"labels": ["kind/bugfix", "bugfix", "fix(front)"]
"labels": ["kind/bugfix", "bugfix", "fix(front)", "fix"]
},
{
"title": "### ✏️ Docs",
Expand All @@ -26,7 +26,7 @@
},
{
"title": "## 📦 Dependencies",
"labels": ["build(front)"]
"labels": ["build(front)", "chore"]
}
],
"sort": "ASC",
Expand All @@ -35,11 +35,11 @@
"empty_template": "- no changes",
"label_extractor": [
{
"pattern": "^(feature|docs|bugfix|optimization|refactor|test):(.*)",
"pattern": "^(feature|docs|bugfix|optimization|refactor|test|feat|fix|style|chore):(.*)",
"target": "$1"
},
{
"pattern": "^(refactor|feat|perf|optimize|fix|docs|test|build|style)\\(front\\):(.*)",
"pattern": "^(refactor|feat|perf|optimize|fix|docs|test|build|style|chore)\\(front\\):(.*)",
"target": "$1(front)"
}
],
Expand Down
19 changes: 9 additions & 10 deletions scripts/workflows/pre-commit/check_commit_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
校验提交信息是否包含规范的前缀
"""
ALLOWED_COMMIT_MSG_PREFIX = [
("feature", "新特性"),
("bugfix", "线上功能bug"),
("minor", "不重要的修改(换行,拼写错误等)"),
("optimization", "功能优化"),
("sprintfix", "未上线代码修改 (功能模块未上线部分bug)"),
("refactor", "功能重构"),
("test", "增加测试代码"),
("docs", "编写文档"),
("merge", "分支合并及冲突解决"),
("feat", "新功能/特性"),
("fix", "Bug修复"),
("docs", "仅文档更改"),
("style", "不影响代码含义的更改(空格、格式、缺少分号等)"),
("refactor", "既不修复错误也不添加功能的代码更改"),
("perf", "提高性能的代码更改"),
("test", "添加缺失的测试或更正现有测试"),
("chore", "对构建过程或辅助工具和库(如文档生成)的更改"),
]


Expand All @@ -44,7 +43,7 @@ def get_commit_message():
def main():
content = get_commit_message()
for prefix in ALLOWED_COMMIT_MSG_PREFIX:
if content.startswith(prefix[0]):
if content.startswith(f"{prefix[0]}:"):
return 0

else:
Expand Down

0 comments on commit 079fcf4

Please sign in to comment.