mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 00:07:16 +00:00
actions: Use github action to do Fixes/Length/Subsystem check
The commit checks does not need to wait for CI dependencies to be installed, It's a waste of time. we need show errors ASAP. And we should display as many problems as possible at once Fixes: #487 Signed-off-by: Tim Zhang <tim@hyper.sh>
This commit is contained in:
parent
06834931a6
commit
c305911def
65
.github/workflows/commit-message-check.yaml
vendored
Normal file
65
.github/workflows/commit-message-check.yaml
vendored
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
name: Commit Message Check
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
- synchronize
|
||||||
|
|
||||||
|
env:
|
||||||
|
error_msg: |+
|
||||||
|
See the document below for help on formatting commits for the project.
|
||||||
|
|
||||||
|
https://github.com/kata-containers/community/blob/master/CONTRIBUTING.md#patch-forma
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
commit-message-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Commit Message Check
|
||||||
|
steps:
|
||||||
|
- name: Get PR Commits
|
||||||
|
id: 'get-pr-commits'
|
||||||
|
uses: tim-actions/get-pr-commits@v1.0.0
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: DCO Check
|
||||||
|
uses: tim-actions/dco@2fd0504dc0d27b33f542867c300c60840c6dcb20
|
||||||
|
with:
|
||||||
|
commits: ${{ steps.get-pr-commits.outputs.commits }}
|
||||||
|
|
||||||
|
- name: Check Subject Line Length
|
||||||
|
uses: tim-actions/commit-message-checker-with-regex@v0.3.0
|
||||||
|
with:
|
||||||
|
commits: ${{ steps.get-pr-commits.outputs.commits }}
|
||||||
|
pattern: '^.{0,75}(\n.*)*$'
|
||||||
|
error: 'Subject too long (max 75)'
|
||||||
|
post_error: ${{ env.error_msg }}
|
||||||
|
|
||||||
|
- name: Check Body Line Length
|
||||||
|
if: ${{ success() || failure() }}
|
||||||
|
uses: tim-actions/commit-message-checker-with-regex@v0.3.0
|
||||||
|
with:
|
||||||
|
commits: ${{ steps.get-pr-commits.outputs.commits }}
|
||||||
|
pattern: '^.+(\n.{0,72})*$|^.+\n\s*[^a-zA-Z\s\n]'
|
||||||
|
error: 'Body line too long (max 72)'
|
||||||
|
post_error: ${{ env.error_msg }}
|
||||||
|
|
||||||
|
- name: Check Fixes
|
||||||
|
if: ${{ success() || failure() }}
|
||||||
|
uses: tim-actions/commit-message-checker-with-regex@v0.3.0
|
||||||
|
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 }}
|
||||||
|
|
||||||
|
- name: Check Subsystem
|
||||||
|
if: ${{ success() || failure() }}
|
||||||
|
uses: tim-actions/commit-message-checker-with-regex@v0.3.0
|
||||||
|
with:
|
||||||
|
commits: ${{ steps.get-pr-commits.outputs.commits }}
|
||||||
|
pattern: '^[\h]*([^:\h]+)[\h]*:'
|
||||||
|
error: 'Failed to find subsystem in subject'
|
||||||
|
post_error: ${{ env.error_msg }}
|
22
.github/workflows/dco-check.yaml
vendored
22
.github/workflows/dco-check.yaml
vendored
@ -1,22 +0,0 @@
|
|||||||
name: DCO check
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- reopened
|
|
||||||
- synchronize
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
dco_check_job:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: DCO Check
|
|
||||||
steps:
|
|
||||||
- name: Get PR Commits
|
|
||||||
id: 'get-pr-commits'
|
|
||||||
uses: tim-actions/get-pr-commits@ed97a21c3f83c3417e67a4733ea76887293a2c8f
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: DCO Check
|
|
||||||
uses: tim-actions/dco@2fd0504dc0d27b33f542867c300c60840c6dcb20
|
|
||||||
with:
|
|
||||||
commits: ${{ steps.get-pr-commits.outputs.commits }}
|
|
Loading…
Reference in New Issue
Block a user