Skip to content

ci(commit-validation): use git to walk commits #1

ci(commit-validation): use git to walk commits

ci(commit-validation): use git to walk commits #1

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