Skip to content

Commit

Permalink
fix: removing problematic areas
Browse files Browse the repository at this point in the history
  • Loading branch information
munja committed Aug 2, 2022
1 parent b5043cc commit 151f120
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions .git-hooks/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,8 @@ GREEN="\033[1;32m"
# Get the commit message (the parameter we're given is just the path to the
# temporary file which holds the message).
commit_message=$(cat "$1")
choretxt=${commit_message:1-15}
echo choretxt=$choretxt

# abort processing if this is a changelog release commit
if [[ "$choretxt" = "chore(release):" ]]; then
echo "${GREEN} ✔ Changelog release"
exit 0
fi

# abort processing if there are linting errors
sasjs lint

# Prevent accidential commits to the master branch
BRANCH=`git rev-parse --abbrev-ref HEAD`
if [[ "$BRANCH" =~ ^(master|main|develop)$ ]]; then
echo "You are on branch $BRANCH. Are you sure you want to commit to this branch?"
echo "If so, commit with -n to bypass the pre-commit hook."
exit 1
fi

# Finally, check the commit message for any obvious mistakes.
# Check the commit message for any obvious mistakes.
if (echo "$commit_message" | grep -Eq "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z0-9 \-]+\))?!?: .+$") then
echo "${GREEN} ✔ Commit message meets Conventional Commit standards"
exit 0
Expand All @@ -36,3 +17,4 @@ echo "An example of a valid message is:"
echo " feat(login): add the 'remember me' button"
echo "ℹ More details at: https://www.conventionalcommits.org/en/v1.0.0/#summary"
exit 1

0 comments on commit 151f120

Please sign in to comment.