From 6704296c63860ab87e86ebaa79783950dedc5ba9 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Sun, 31 Dec 2023 02:29:30 +0000 Subject: [PATCH 1/3] feat: Updated scripts/githooks/commit-msg --- scripts/githooks/commit-msg | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/githooks/commit-msg b/scripts/githooks/commit-msg index bc76a56..fd05574 100644 --- a/scripts/githooks/commit-msg +++ b/scripts/githooks/commit-msg @@ -53,10 +53,11 @@ GITLINT_DIR="./_output/tools/go-gitlint" if ! command -v $GITLINT_DIR &>/dev/null; then echo "$GITLINT_DIR not found. Attempting to install it..." - # Add the commands to download and install the go-gitlint tool here + wget https://github.com/llorllale/go-gitlint/releases/latest/download/go-gitlint_${GOOS}_${GOARCH}.tar.gz -O go-gitlint.tar.gz || curl -L https://github.com/llorllale/go-gitlint/releases/latest/download/go-gitlint_${GOOS}_${GOARCH}.tar.gz -o go-gitlint.tar.gz + tar xzf go-gitlint.tar.gz -C ./_output/tools/ && chmod +x $GITLINT_DIR if [ $? -ne 0 ]; then - printError "Failed to install $GITLINT_DIR. Please run 'make tools' OR 'make tools.verify.go-gitlint' make verto install it manually." - exit 1 + printError "Installation of $GITLINT_DIR failed. Please check your network connection, ensure you have the necessary permissions, and run 'make tools' OR 'make tools.verify.go-gitlint' to install it manually." + exit 2 fi fi @@ -77,5 +78,5 @@ then fi printError "Please fix your commit message to match kubecub coding standards" printError "https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694#file-githook-md" - exit 1 + exit 2 fi \ No newline at end of file From 18ebb587cb0a9f303c171e00e30b5f2df9fe928a Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Sun, 31 Dec 2023 02:30:06 +0000 Subject: [PATCH 2/3] feat: Updated scripts/githooks/pre-commit --- scripts/githooks/pre-commit | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/githooks/pre-commit b/scripts/githooks/pre-commit index 7660e5d..4e4ccc1 100644 --- a/scripts/githooks/pre-commit +++ b/scripts/githooks/pre-commit @@ -67,6 +67,11 @@ cd $repo_root empty_tree=$( git hash-object -t tree /dev/null ) +if ! command -v $GITLINT_DIR &>/dev/null; then + printError "The go-gitlint tool is required for the commit-msg hook. Please run the commit-msg hook manually to install the tool." + exit 1 +fi + if git rev-parse --verify HEAD > /dev/null 2>&1 then against=HEAD @@ -94,6 +99,12 @@ then exit 1; fi +if [ $? -ne 0 ] +then + printError "The commit-msg hook failed. Please check the error logs for more information." + exit 1 +fi + if [[ ! $local_branch =~ $valid_branch_regex ]] then printError "There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex. From 756e2245dd69ac59beaf70211a76603e9195356a Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Sun, 31 Dec 2023 02:42:27 +0000 Subject: [PATCH 3/3] feat: Updated scripts/githooks/pre-commit --- scripts/githooks/pre-commit | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/githooks/pre-commit b/scripts/githooks/pre-commit index 4e4ccc1..ea28b39 100644 --- a/scripts/githooks/pre-commit +++ b/scripts/githooks/pre-commit @@ -68,7 +68,7 @@ cd $repo_root empty_tree=$( git hash-object -t tree /dev/null ) if ! command -v $GITLINT_DIR &>/dev/null; then - printError "The go-gitlint tool is required for the commit-msg hook. Please run the commit-msg hook manually to install the tool." + printError "The go-gitlint tool is not installed. Please run 'make tools' OR 'make tools.verify.go-gitlint' to install it." exit 1 fi @@ -102,7 +102,8 @@ fi if [ $? -ne 0 ] then printError "The commit-msg hook failed. Please check the error logs for more information." - exit 1 + exit 2 +fi fi if [[ ! $local_branch =~ $valid_branch_regex ]]