Merging dev into main #49
17
.githooks/commit-msg
Executable file
17
.githooks/commit-msg
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
commit_msg_file=$1
|
||||||
|
commit_msg=$(cat "$commit_msg_file")
|
||||||
|
|
||||||
|
if echo "$commit_msg" | grep -Eq "^(feat|fix|refactor|perf|style|test|docs|build|chore|revert): .+"; then
|
||||||
|
if echo "$commit_msg" | grep -Eq "^(ref|close):\sN25B-.+"; then
|
||||||
|
echo "🎉 commit message is Valid"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "❌ Commit message invalid! Must end with [ref/close]: N25B-000"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "❌ Commit message invalid! Must start with <type>: <description>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
18
.githooks/pre-commit
Executable file
18
.githooks/pre-commit
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Get current branch
|
||||||
|
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
|
||||||
|
if echo "$branch" | grep -Eq "(dev|main)"; then
|
||||||
|
echo 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# allowed pattern <type/>
|
||||||
|
if echo "$branch" | grep -Eq "^(feat|fix|refactor|perf|style|test|docs|build|chore|revert)\/\w+-\w+-\w+"; then
|
||||||
|
echo "✅ Branch name valid: $branch"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "❌ Invalid branch name: $branch"
|
||||||
|
echo "Branch must be named <type>/<description-of-branch> (must have 2 stipes - -)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
9
.githooks/prepare-commit-msg
Executable file
9
.githooks/prepare-commit-msg
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "#<type>: <description>
|
||||||
|
|
||||||
|
#[optional body]
|
||||||
|
|
||||||
|
#[optional footer(s)]
|
||||||
|
|
||||||
|
#[ref/close]: <issue identifier>" > $1
|
||||||
14
README.md
14
README.md
@@ -27,3 +27,17 @@ npm run dev
|
|||||||
```
|
```
|
||||||
|
|
||||||
It should automatically reload when you save changes.
|
It should automatically reload when you save changes.
|
||||||
|
|
||||||
|
## GitHooks
|
||||||
|
|
||||||
|
To activate automatic commits/branch name checks run:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git config --local core.hooksPath .githooks
|
||||||
|
```
|
||||||
|
|
||||||
|
If your commit fails its either:
|
||||||
|
branch name != <type>/description-of-branch
|
||||||
|
commit name != <type>: description of the commit.
|
||||||
|
<ref>: N25B-Num's
|
||||||
|
|
||||||
|
|||||||
@@ -14,4 +14,4 @@ function App(){
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default App
|
export default App
|
||||||
Reference in New Issue
Block a user