Skip to content

Commit 97f6141

Browse files
committed
#4215 Add commit number hooks (RQ from Chris)
1 parent c4ae982 commit 97f6141

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

.githooks/commit-msg

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
commit_msg=$(cat "$1")
3+
4+
branch=$(git symbolic-ref --short HEAD)
5+
ticket=$(echo "$branch" | grep -oE '#[0-9]+')
6+
7+
if [ -n "$ticket" ] && ! echo "$commit_msg" | grep -qE "^#[0-9]+"; then
8+
echo "$ticket $commit_msg" > "$1"
9+
fi

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"src/docs-site"
1111
],
1212
"scripts": {
13+
"setup:hooks": "git config core.hooksPath .githooks",
1314
"prettier-check": "yarn prettier --check .",
1415
"frontend": "yarn workspace frontend start",
1516
"backend": "yarn workspace backend start",

0 commit comments

Comments
 (0)