From 2466ac73bbf88accfb27419213f26c2dd566ac84 Mon Sep 17 00:00:00 2001 From: Tim Zhang Date: Thu, 13 Aug 2020 16:59:07 +0800 Subject: [PATCH 1/5] actions: Fix 'Fixes checking' problem by update dependent action The Fixes checking should pass as long as one of the commits of pull-request pass the check. update depdent github-action commit-message-checker-with-regex to v0.3.1 shortlog: d6d9770 commit-message-checker-with-regex: Add input one_pass_all_pass Fixes: #519 Signed-off-by: Tim Zhang --- .github/workflows/commit-message-check.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/commit-message-check.yaml b/.github/workflows/commit-message-check.yaml index f94f722d6..e954cd032 100644 --- a/.github/workflows/commit-message-check.yaml +++ b/.github/workflows/commit-message-check.yaml @@ -29,7 +29,7 @@ jobs: commits: ${{ steps.get-pr-commits.outputs.commits }} - name: Check Subject Line Length - uses: tim-actions/commit-message-checker-with-regex@v0.3.0 + uses: tim-actions/commit-message-checker-with-regex@v0.3.1 with: commits: ${{ steps.get-pr-commits.outputs.commits }} pattern: '^.{0,75}(\n.*)*$' @@ -38,7 +38,7 @@ jobs: - name: Check Body Line Length if: ${{ success() || failure() }} - uses: tim-actions/commit-message-checker-with-regex@v0.3.0 + uses: tim-actions/commit-message-checker-with-regex@v0.3.1 with: commits: ${{ steps.get-pr-commits.outputs.commits }} pattern: '^.+(\n.{0,72})*$|^.+\n\s*[^a-zA-Z\s\n]' @@ -47,17 +47,18 @@ jobs: - name: Check Fixes if: ${{ success() || failure() }} - uses: tim-actions/commit-message-checker-with-regex@v0.3.0 + uses: tim-actions/commit-message-checker-with-regex@v0.3.1 with: commits: ${{ steps.get-pr-commits.outputs.commits }} pattern: '\s*Fixes\s*:?\s*(#\d+|github\.com\/kata-containers\/[a-z-.]*#\d+)' flags: 'i' error: 'No "Fixes" found' post_error: ${{ env.error_msg }} + one_pass_all_pass: 'true' - name: Check Subsystem if: ${{ success() || failure() }} - uses: tim-actions/commit-message-checker-with-regex@v0.3.0 + uses: tim-actions/commit-message-checker-with-regex@v0.3.1 with: commits: ${{ steps.get-pr-commits.outputs.commits }} pattern: '^[\h]*([^:\h]+)[\h]*:' From 8c46a41b96605f385b64cca20f947becca01bdf3 Mon Sep 17 00:00:00 2001 From: Tim Zhang Date: Thu, 13 Aug 2020 17:04:13 +0800 Subject: [PATCH 2/5] actions: Fix subsystem checking in github-action The former regex mistakenly count SoB(DCO) as a valid subsystem. This commit will fix this issue. Fixes: #520 Signed-off-by: Tim Zhang --- .github/workflows/commit-message-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/commit-message-check.yaml b/.github/workflows/commit-message-check.yaml index e954cd032..08565907b 100644 --- a/.github/workflows/commit-message-check.yaml +++ b/.github/workflows/commit-message-check.yaml @@ -61,6 +61,6 @@ jobs: uses: tim-actions/commit-message-checker-with-regex@v0.3.1 with: commits: ${{ steps.get-pr-commits.outputs.commits }} - pattern: '^[\h]*([^:\h]+)[\h]*:' + pattern: '^[\h]*([^:\h\n]+)[\h]*:' error: 'Failed to find subsystem in subject' post_error: ${{ env.error_msg }} From d81af48ae50b636889b6a83c8823694f2cc795ae Mon Sep 17 00:00:00 2001 From: Tim Zhang Date: Thu, 13 Aug 2020 18:41:27 +0800 Subject: [PATCH 3/5] actions: Do not limit the length of single word in commit body If the line comprises of only a single word, it may be something like a URL (it's certainly very unlikely to be a normal word if the default lengths are being used), so length checks won't be applied to it. Signed-off-by: Tim Zhang --- .github/workflows/commit-message-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/commit-message-check.yaml b/.github/workflows/commit-message-check.yaml index 08565907b..f5cb79d96 100644 --- a/.github/workflows/commit-message-check.yaml +++ b/.github/workflows/commit-message-check.yaml @@ -41,7 +41,7 @@ jobs: uses: tim-actions/commit-message-checker-with-regex@v0.3.1 with: commits: ${{ steps.get-pr-commits.outputs.commits }} - pattern: '^.+(\n.{0,72})*$|^.+\n\s*[^a-zA-Z\s\n]' + pattern: '^.+(\n.{0,72})*$|^.+\n\s*[^a-zA-Z\s\n]|^.+\n\S+$' error: 'Body line too long (max 72)' post_error: ${{ env.error_msg }} From 9f0fef5add10f3b73028baffada0e5fc593f8e5c Mon Sep 17 00:00:00 2001 From: Tim Zhang Date: Thu, 13 Aug 2020 19:04:16 +0800 Subject: [PATCH 4/5] actions: Add commit-body-missing check Check if the commit body is missing use github action. Signed-off-by: Tim Zhang --- .github/workflows/commit-message-check.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/commit-message-check.yaml b/.github/workflows/commit-message-check.yaml index f5cb79d96..8cb4bc458 100644 --- a/.github/workflows/commit-message-check.yaml +++ b/.github/workflows/commit-message-check.yaml @@ -28,6 +28,12 @@ jobs: with: commits: ${{ steps.get-pr-commits.outputs.commits }} + - name: Commit Body Missing Check + if: ${{ success() || failure() }} + uses: tim-actions/commit-body-check@v1.0.2 + with: + commits: ${{ steps.get-pr-commits.outputs.commits }} + - name: Check Subject Line Length uses: tim-actions/commit-message-checker-with-regex@v0.3.1 with: From 2889af7710dc433ce3b6d72af952a70b1ccb258a Mon Sep 17 00:00:00 2001 From: Tim Zhang Date: Thu, 13 Aug 2020 19:37:15 +0800 Subject: [PATCH 5/5] actions: Run subject-line-length check even if the previous checks failed So that we can see as many errors as possible at once. Signed-off-by: Tim Zhang --- .github/workflows/commit-message-check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/commit-message-check.yaml b/.github/workflows/commit-message-check.yaml index 8cb4bc458..5b69585b0 100644 --- a/.github/workflows/commit-message-check.yaml +++ b/.github/workflows/commit-message-check.yaml @@ -35,6 +35,7 @@ jobs: commits: ${{ steps.get-pr-commits.outputs.commits }} - name: Check Subject Line Length + if: ${{ success() || failure() }} uses: tim-actions/commit-message-checker-with-regex@v0.3.1 with: commits: ${{ steps.get-pr-commits.outputs.commits }}