We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e4f0d58 commit 40f8030Copy full SHA for 40f8030
commit-msg
@@ -0,0 +1,25 @@
1
+#!/bin/bash
2
+
3
+# Declare emojis
4
+emojis=("🏗️" "🔧" "👷" "📚" "✨" "🐛" "🏎" "♻️" "⏪️" "🎨" "🧪" "🚧")
5
+types=("build" "chore" "ci" "docs" "feat" "fix" "perf" "refactor" "revert" "style" "test" "wip")
6
7
+# Get header and body from commit message
8
+header="$(head -n 1 $1)";
9
+body="$(tail -n +2 $1)";
10
11
+# Loop through all types
12
+for key in "${!types[@]}"; do
13
14
+ # Check, if emoji is already present
15
+ if [[ "$header" == *"${types[key]}"* ]] && [[ "$header" == *"${emojis[key]}"* ]]; then
16
+ exit 0;
17
+ fi
18
19
+ # Add emoji to commit message
20
+ if [[ "$header" == *"${types[key]}"* ]] && [[ "$header" != *"${emojis[key]}"* ]]; then
21
+ printf "$header ${emojis[key]}\n$body" > $1
22
23
24
25
+done
0 commit comments