• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Commit Message Check
2on:
3  pull_request:
4    types:
5      - opened
6      - reopened
7      - synchronize
8
9env:
10  error_msg: |+
11    See the document below for help on formatting commits for the project.
12
13    https://github.com/kata-containers/community/blob/master/CONTRIBUTING.md#patch-forma
14
15jobs:
16  commit-message-check:
17    runs-on: ubuntu-latest
18    name: Commit Message Check
19    steps:
20    - name: Get PR Commits
21      id: 'get-pr-commits'
22      uses: tim-actions/get-pr-commits@v1.0.0
23      with:
24        token: ${{ secrets.GITHUB_TOKEN }}
25
26    - name: DCO Check
27      uses: tim-actions/dco@2fd0504dc0d27b33f542867c300c60840c6dcb20
28      with:
29        commits: ${{ steps.get-pr-commits.outputs.commits }}
30
31    - name: Commit Body Missing Check
32      if: ${{ success() || failure() }}
33      uses: tim-actions/commit-body-check@v1.0.2
34      with:
35        commits: ${{ steps.get-pr-commits.outputs.commits }}
36
37    - name: Check Subject Line Length
38      if: ${{ success() || failure() }}
39      uses: tim-actions/commit-message-checker-with-regex@v0.3.1
40      with:
41        commits: ${{ steps.get-pr-commits.outputs.commits }}
42        pattern: '^.{0,75}(\n.*)*$'
43        error: 'Subject too long (max 75)'
44        post_error: ${{ env.error_msg }}
45
46    - name: Check Body Line Length
47      if: ${{ success() || failure() }}
48      uses: tim-actions/commit-message-checker-with-regex@v0.3.1
49      with:
50        commits: ${{ steps.get-pr-commits.outputs.commits }}
51        pattern: '^.+(\n.{0,72})*$|^.+\n\s*[^a-zA-Z\s\n]|^.+\n\S+$'
52        error: 'Body line too long (max 72)'
53        post_error: ${{ env.error_msg }}
54