-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚀 feat: add commitizen workflow checker
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Check Conventional Commit | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
check-commit-message: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Check Conventional Commit | ||
run: | | ||
# Define the conventional commit types with emojis | ||
TYPES=("🚀 feat" "🐛 fix" "📝 docs" "✨ style" "🛠 refactor" "⚡️ perf" "🔬 test" "🔧 build" "🤖 ci" "🧹 chore" "⏪ revert") | ||
# Extract the commit type and emoji from the commit message | ||
COMMIT_MSG=$(git log --format=%B -n 1) | ||
for type in "${TYPES[@]}"; do | ||
type_emoji=${type} | ||
type=${type_emoji#* } | ||
emoji=${type_emoji% *} | ||
if [[ $COMMIT_MSG == $emoji* ]]; then | ||
echo "Commit message is a conventional commit" | ||
exit 0 | ||
fi | ||
done | ||
# If we reach here, the commit message is not a conventional commit | ||
echo "Commit message is not a conventional commit" | ||
exit 1 |