🔧 fix(workflows): debug for continued issue #4
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: Conventional Commit Checker | |
on: | |
push: | |
branches: | |
- main | |
- master | |
- development | |
jobs: | |
conventional-commit-checker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Get latest commit message | |
run: | | |
LATEST_COMMIT_MESSAGE=$(git log -1 --format=%s) | |
echo "LATEST_COMMIT_MESSAGE=$LATEST_COMMIT_MESSAGE" >> $GITHUB_ENV | |
- name: Check conventional commit message | |
run: | | |
conventional_types=("build" "chore" "ci" "docs" "feat" "fix" "perf" "refactor" "revert" "style" "test") | |
commit_emojis=("build"="🏗️" "chore"="🧹" "ci"="🤖" "docs"="📚" "feat"="🎉" "fix"="🔧" "perf"="⚡️" "refactor"="💡" "revert"="🚨" "style"="💄" "test"="🧪") | |
echo "LATEST_COMMIT_MESSAGE: $LATEST_COMMIT_MESSAGE" | |
for type in "${conventional_types[@]}"; do | |
pattern="^${commit_emojis[$type]} ${type}(:|:)" | |
echo "Searching for pattern: $pattern" | |
if echo "$LATEST_COMMIT_MESSAGE" | awk -v emoji="${commit_emojis[$type]}" -v type="$type" ' | |
BEGIN { pattern = "^" emoji " " type "(:|:)" } | |
/pattern/ { print "Conventional commit message found: " $0; exit 0 } | |
'; then | |
: | |
else | |
: | |
fi | |
done | |
echo "Error: Commit message is not conventional" | |
exit 1 |