Skip to content

[community-service] (feat): impliemnt discussion replies #278

[community-service] (feat): impliemnt discussion replies

[community-service] (feat): impliemnt discussion replies #278

Workflow file for this run

name: Commit Message Lint
on:
pull_request:
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: false
- name: Check commit messages
run: |
# Fetch commit hashes between origin/master and HEAD
commits=$(git log origin/master..HEAD --pretty=format:%H)
# Loop through each commit to validate message
for commit in $commits; do
# Get commit message and author
commit_msg=$(git log -1 --pretty=format:%s $commit)
author=$(git log -1 --pretty=format:'%an' $commit)
echo "🔎 Checking commit: $commit_msg (by $author)"
# Skip merge commits
if echo "$commit_msg" | grep -qE "^Merge"; then
echo "➡️ Skipping merge commit: $commit_msg"
continue
fi
# Skip bot commits
if [[ "$author" == "allcontributors[bot]" ]]; then
echo "🤖 Skipping All Contributors bot commit: $commit_msg"
continue
fi
# Check minimum length
if [ ${#msg} -lt 5 ]; then
echo "❌ Commit message too short: $msg"
echo "Message must be at least 5 characters"
exit 1
fi
done