Skip to content

feat: Create test.txt #8

feat: Create test.txt

feat: Create test.txt #8

Workflow file for this run

name: Commit Message Check
on:
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
commit-message-check:
runs-on: ubuntu-latest
steps:
- name: Check Commit Message
id: check-commit-message
run: |
COMMIT_MESSAGE=$(git log --format=%s -n 1 $GITHUB_SHA)
ALLOWED_PREFIXES=("feat!" "feat" "fix" "patch" "chore" "build" "debug" "refactor" "revert" "ci" "perf" "style" "test" "docs" "wip")
VALID=false
for PREFIX in "${ALLOWED_PREFIXES[@]}"; do
if [[ $COMMIT_MESSAGE == "$PREFIX"* ]]; then
VALID=true
break
fi
done
if [[ $VALID == true ]]; then
echo "Commit message is valid."
exit 0
else
echo "Invalid commit message. Please use one of the allowed prefixes: ${ALLOWED_PREFIXES[*]}"
exit 1
fi