From d659b0cbe25daa16a69ef91e3c1935a7e2df70d8 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Tue, 16 Jan 2024 05:15:56 +0000 Subject: [PATCH 1/2] feat: Updated scripts/githooks/pre-commit.sh --- scripts/githooks/pre-commit.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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" From 10d0cb6f496b71b2050889b8416e66dc8833616d Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Tue, 16 Jan 2024 05:16:36 +0000 Subject: [PATCH 2/2] feat: Updated scripts/githooks/go-gitlint.sh --- scripts/githooks/go-gitlint.sh | 5 +++++ 1 file changed, 5 insertions(+) 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?.*"