commit message check #60
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: commit message check | |
run-name: commit message check | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
check_commit_messages: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: show logs | |
run: git log --format="%s" origin/main..HEAD | |
- name: check commit messages | |
run: | | |
git log --format="%s" origin/main..HEAD | while IFS= read -r message; do | |
if ! [[ $message =~ ^(vingo:|vinscant:|vinvoor:|zess:) ]]; then | |
echo $message | |
echo "Error: commit message should start with vingo:|vinscant:|vinvoor:|zess: depending on which subproject you are working on." | |
exit 1 | |
fi | |
if ! [[ $message =~ ^.*:\ [a-z].* ]]; then | |
echo $message | |
echo "Error: first letter after project specifier should be lower case" | |
exit 1 | |
fi | |
done |