This repository was archived by the owner on Mar 5, 2025. It is now read-only.
Commit 7dcf845 1 parent 17f2c30 commit 7dcf845 Copy full SHA for 7dcf845
File tree 1 file changed +18
-4
lines changed
1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change 4
4
#
5
5
# You may adapt the message length check. Currently checking it's longer than
6
6
# 15 characters.
7
- ROOT_DIR=" $( pwd) /"
8
- PREFIX=$( $ROOT_DIR /vendor/bin/drupal yaml:get:value $ROOT_DIR /blt/project.yml project.prefix)
9
- regex=" ^${PREFIX} -[0-9]+(: )[^ ].{15,}\."
7
+
8
+ ROOT_DIR=" $( pwd) "
9
+ COMMAND=" $ROOT_DIR /vendor/bin/drupal yaml:get:value $ROOT_DIR /blt/project.yml project.prefix"
10
+ ERROR=$( $COMMAND 2>&1 > /dev/null)
11
+ PREFIX=$( $COMMAND )
10
12
RED=' \033[0;31m'
11
13
NO_COLOR=' \033[0m'
14
+
15
+ # Make sure there are no errors while running drupal console command
16
+ # todo: It would have be easy, just by discarding the std error, but for some
17
+ # reason the error message is repeated on std out - which messes up everything.
18
+ if [ -n " $ERROR " ]; then
19
+ printf " ${RED} Error: could not get project prefix!${NO_COLOR} Please check:\n"
20
+ echo " * Project prefix is set properly in project.yml."
21
+ echo " * Drupal console is configured properly, to configure run \" drupal init\" ."
22
+ exit 1;
23
+ fi
24
+
25
+ # Validate the commit message.
26
+ regex=" ^${PREFIX} -[0-9]+(: )[^ ].{15,}\."
12
27
if ! grep -iqE " $regex " " $1 " ; then
13
28
printf " ${RED} Error: invalid commit message!${NO_COLOR} Commit messages must:\n"
14
29
echo " * Contain the project prefix followed by a hyphen"
@@ -17,4 +32,3 @@ if ! grep -iqE "$regex" "$1"; then
17
32
echo " Valid example: $PREFIX -135: Added the new picture field to the article feature."
18
33
exit 1;
19
34
fi
20
-
You can’t perform that action at this time.
0 commit comments