Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check length of commit messages on PR CI #3587

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/check-commit-msg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Check Commit Messages

on:
pull_request:


jobs:
length:
name: Check that length of commit messages are <72 characters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fetch branch data from origin
run: git fetch origin
- run: |
COMMIT_MESSAGES=$(git log --combined --format=%s origin/$GITHUB_BASE_REF..HEAD)
echo $COMMIT_MESSAGES
for MESSAGE in $COMMIT_MESSAGES; do
LENGTH=$(echo $MESSAGE | wc -c)
if [ $LENGTH -gt 72 ]; then
echo "Commit message \"$MESSAGE\" is too long ($LENGTH characters). Please keep commit messages under 72 characters."
exit 1
fi
done
Loading