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 b736096 commit e865a97Copy full SHA for e865a97
pre-receive-hooks/require-jira-issue.sh
@@ -0,0 +1,29 @@
1
+#!/usr/bin/env bash
2
+
3
+zero_commit="0000000000000000000000000000000000000000"
4
5
+read oldrev newrev refname
6
+echo $oldrev $newrev $refname
7
8
+check_message_format ()
9
+# enforced custom commit message format
10
+{
11
+ message=`git cat-file commit $newrev | sed '1,/^$/d'`
12
+ regex="/*\[jira-.*\]"
13
+ echo "[COMMIT MESSAGE]:" $message
14
+ if [[ $message =~ $regex ]];
15
+ then
16
+ echo "Commit message looks good!"
17
+ exit 0
18
+ else
19
+ echo "[POLICY] Commit message does not contain a JIRA ticket #"
20
+ exit 1
21
22
+ fi
23
+}
24
25
+if [ "$newrev" = "$zero_commit" ]; then
26
+ continue
27
+else
28
+ check_message_format
29
+fi
0 commit comments