aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/commit-validation-pr.yml
blob: ba2ea4e1e9c4d252ec23903982093afc8681ec7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
name: commit-validation-pr
on: [pull_request]

permissions:
  contents: read

jobs:
  check-commit-msg-length:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v5
      with:
        fetch-depth: 0
    - name: Check commit message length
      run: |
          git log ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | (
            longlines=0
            while IFS='' read -r line; do
              if [ "${#line}" -gt 78 ]; then
                echo "Overlong line: ${line}" >&2
                longlines=$(( longlines + 1 ))
              fi
            done
            [ "${longlines}" -eq 0 ]
          )