diff --git a/scripts/githooks/go-gitlint.sh b/scripts/githooks/go-gitlint.sh index d8ed90cf..ab3641b4 100644 --- a/scripts/githooks/go-gitlint.sh +++ b/scripts/githooks/go-gitlint.sh @@ -15,6 +15,11 @@ # limitations under the License. run_go_gitlint() { + local commit_msg_file="\$1" + local go_gitlint_target="go-gitlint" + local subject_regex="^(build|chore|ci|docs|feat|feature|fix|perf|refactor|revert|style|bot|test):\\\s?.*" + local subject_maxlen=150 + local subject_minlen=10 local commit_msg_file="$1" local go_gitlint_target="go-gitlint" local subject_regex="^(build|chore|ci|docs|feat|feature|fix|perf|refactor|revert|style|bot|test)(.*)?:\s?.*" diff --git a/scripts/githooks/pre-commit.sh b/scripts/githooks/pre-commit.sh index dd999dea..2bca8081 100644 --- a/scripts/githooks/pre-commit.sh +++ b/scripts/githooks/pre-commit.sh @@ -65,7 +65,7 @@ printMessage "Running local openim pre-commit hook." # https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694#file-githook-md # TODO! GIT_FILE_SIZE_LIMIT=2000000 git commit -m "test: this commit is allowed file sizes up to 50MB" # Maximum file size limit in bytes -limit=${GIT_FILE_SIZE_LIMIT:-50000000} # Default 50MB +limit=${GIT_FILE_SIZE_LIMIT:-2000000} # Default 2MB limitInMB=$(( $limit / 1000000 )) function file_too_large(){ @@ -98,7 +98,7 @@ IFS=' shouldFail=false for file in $( git diff-index --cached --name-only $against ); do file_size=$(([ ! -f $file ] && echo 0) || (ls -la "$file" | awk '{ print $5 }')) - if [ "$file_size" -gt "$limit" ] && { grep -q ".github/release-drafter.yml" $file ;}; then + if [ "$file_size" -gt "$limit" ]; then printError "File $file is $(( $file_size / 10**6 )) MB, which is larger than our configured limit of $limitInMB MB" shouldFail=true printError "File $file is $(( $file_size / 10**6 )) MB, which is larger than our configured limit of $limitInMB MB"