Skip to content

CI: Update main.yml #16

CI: Update main.yml

CI: Update main.yml #16

Workflow file for this run

name: Commit Message Prefix Check
on: [push]
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get Commit Message
run: |
commit_message=$(git log --format=%B -n 1 ${{ github.event.before }})
valid_prefixes=("feat!" "feat" "fix" "patch" "chore" "build" "debug" "refactor" "revert" "ci" "perf" "style" "test" "docs" "wip")
valid_commit=0
for prefix in "${valid_prefixes[@]}"; do
if [[ $commit_message == "$prefix"* ]]; then
valid_commit=1
break
fi
done
if [ $valid_commit -eq 1 ]; then
echo "Commit message includes a valid prefix. Build passed."
echo $commit_message
else
echo "Commit message does not include a valid prefix. Build failed."
echo $commit_message
exit 1
fi