From 2e9f7f46e5f9f1aad1fbd20ade7bc3014d8bcbd1 Mon Sep 17 00:00:00 2001 From: LidolLxf <13660354959@163.com> Date: Thu, 27 Jun 2024 15:18:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=E8=A7=84?= =?UTF-8?q?=E8=8C=83=E6=96=87=E6=A1=A3/=E6=96=B0=E5=A2=9Egithub=20action?= =?UTF-8?q?=E8=A7=84=E8=8C=83PR=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr-lint.yml | 14 ++++++++++++++ docs/specification/commit-spec.md | 18 +++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/pr-lint.yml diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml new file mode 100644 index 0000000000..2171cf74dc --- /dev/null +++ b/.github/workflows/pr-lint.yml @@ -0,0 +1,14 @@ +name: pr-lint +on: [push, 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: 添加新功能'" + exit 1 + fi \ No newline at end of file diff --git a/docs/specification/commit-spec.md b/docs/specification/commit-spec.md index 2337d0f44b..905d195eae 100644 --- a/docs/specification/commit-spec.md +++ b/docs/specification/commit-spec.md @@ -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 From d9661043e0b4be7021400382811d3afe61d8c289 Mon Sep 17 00:00:00 2001 From: LidolLxf <13660354959@163.com> Date: Thu, 27 Jun 2024 15:40:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9Egithub=20action=E8=A7=84?= =?UTF-8?q?=E8=8C=83PR=E6=A0=BC=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr-lint.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml index 2171cf74dc..2fccf9467d 100644 --- a/.github/workflows/pr-lint.yml +++ b/.github/workflows/pr-lint.yml @@ -1,5 +1,5 @@ name: pr-lint -on: [push, pull_request] +on: [pull_request] jobs: PR-format-check: runs-on: ubuntu-latest @@ -9,6 +9,8 @@ jobs: 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: 添加新功能'" + 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 \ No newline at end of file