mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-19 10:45:30 +08:00
37 lines
918 B
YAML
37 lines
918 B
YAML
name: commit-validation
|
|
on: [ push, pull_request ]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
check-commit-msg-length:
|
|
runs-on: ubuntu-latest
|
|
id: check-commit-msg-length
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Check commit message length
|
|
with:
|
|
result-encoding: json
|
|
script: |
|
|
var longlines = [];
|
|
const commits = ${{ toJSON(github.event.commits) }}
|
|
for (const commit of commits) {
|
|
if (/^.{79}/.test(commit.message)) {
|
|
longlines.push(commit.sha)
|
|
}
|
|
}
|
|
return longlines
|
|
- name: Get result
|
|
run: |
|
|
result="${{steps.check-commit-msg-length.outputs.result}}"
|
|
if [[ $result = "" ]]; then
|
|
echo "Ok"
|
|
exit 0
|
|
else
|
|
echo "Commit messages for these commits contain lines > 78 characters:"
|
|
echo $result
|
|
exit 1
|
|
fi
|
|
|