Files
pandoc/.github/workflows/commit-validation.yml
dependabot[bot] 347fbb1ab2 Bump actions/github-script from 7 to 8
Bumps [actions/github-script](https://github.com/actions/github-script) from 7 to 8.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v7...v8)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-08 09:17:43 +02:00

40 lines
1.1 KiB
YAML

name: commit-validation
on: [ push ]
permissions:
contents: read
jobs:
check-commit-msg-length:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Check commit message length
id: check-commit-msg-length
uses: actions/github-script@v8
with:
result-encoding: json
script: |
var longlines = 0;
const commits = ${{ toJSON(github.event.commits) }};
for (const commit of commits) {
for (const line of commit.message.split('\n')) {
if (line.length > 78) {
longlines += 1;
console.log("Overlong line:\n" + line);
}
}
}
return longlines
- name: Get result
run: |
result=${{steps.check-commit-msg-length.outputs.result}}
if [[ $result -eq 0 ]]; then
echo "Ok"
exit 0
else
echo "Commit messages contain $result lines longer than 78 characters."
echo "See under 'Check commit message length' for a list of the lines."
exit 1
fi