Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: pr-lint
on: [pull_request]
jobs:
PR-format-check:
runs-on: ubuntu-latest
steps:
- name: Check PR naming convention
run: |
title="${{ github.event.pull_request.title }}"
pattern="^(feat|fix|docs|style|refactor|perf|test|chore|revert|build|ci): .*"
if [[ ! $title =~ $pattern ]]; then
echo "PR title does not match naming convention. Example: 'feat: 添加新功能'.\
You can refer to this address for details:\
https://github.com/TencentBlueKing/bk-bcs/blob/master/docs/specification/commit-spec.md"
exit 1
fi
18 changes: 11 additions & 7 deletions docs/specification/commit-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,28 @@

## 代码检查建议

BCS团队默认使用gometalinter进行代码检查,为了提高Merge效率,请提交前先使用[gometalinter](https://github.com/alecthomas/gometalinter)进行检查。
BCS团队默认使用golangci-lint进行代码检查,为了提高Merge效率,请提交前先使用[golangci-lint](https://github.com/golangci/golangci-lint)进行检查。

## commit相关格式

个人分支提交commit消息格式
个人分支提交commit消息格式,英文冒号,后跟英文空格

```
type:messsge issue
type: messsge issue
```

* type 范围信息
* feature 新功能
* fix 错误修复
* feat 添加新功能/新特性
* fix 错误修复,bug修复
* docs 文档更改
* style (格式化,缺少半冒号等;没有代码更改)
* refactor 代码重构重构
* style 代码格式化,如空格、缩进、缺少半冒号等;没有代码更改
* refactor 代码重构,没有添加新功能或bug修复
* perf 添加代码进行性能测试或性能优化
* test 添加缺失的测试,重构测试;没有生产代码更改
* chore 构建脚本,任务等相关代码
* revert 回滚某次提交
* build 构建系统或外部依赖项的更改(如webpack,npm,go.mod等)
* ci 持续集成相关的变动
* message 本次提交的描述
* issue 本次提交关联的issue id

Expand Down