From ad686e002362a3977eb266ef1fc40e7a746543f0 Mon Sep 17 00:00:00 2001 From: hijiki51 Date: Wed, 12 Jul 2023 01:27:47 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20remove=20pre-commit=20h?= =?UTF-8?q?ook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/hooks/pre-commit | 45 ---------------------------------------- .github/hooks/pre-push | 13 ------------ 2 files changed, 58 deletions(-) delete mode 100755 .github/hooks/pre-commit delete mode 100755 .github/hooks/pre-push diff --git a/.github/hooks/pre-commit b/.github/hooks/pre-commit deleted file mode 100755 index 32269928684..00000000000 --- a/.github/hooks/pre-commit +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# Modified from https://github.com/chaitanyagupta/gitutils - -[ -n "$CI" ] && exit 0 - -GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) -if [ "$GIT_BRANCH" = "main" ]; then - yarn lint-staged --relative - lintStatus=$? - - if [ $lintStatus -ne 0 ]; then - echo "❌ Linting failed" - exit 1 - fi -fi - -green='\033[0;32m' -no_color='\033[0m' -grey='\033[0;90m' -red='\033[0;31m' - -ROOT_DIR=$(git rev-parse --show-cdup) -SUBMODULES=$(grep path ${ROOT_DIR}.gitmodules | sed 's/^.*path = //') -MOD_SUBMODULES=$(git diff --cached --name-only --ignore-submodules=none | grep -F "$SUBMODULES") - -echo -e "Checking submodules ${grey}(pre-commit hook)${no_color} " - -# If no modified submodules, exit with status code 0, else prompt the -# user and exit accordingly -if [[ -n "$MOD_SUBMODULES" ]]; then - echo "Submodules to be committed:" - echo " (use \"git reset HEAD ...\" to unstage)" - echo - - for SUB in $MOD_SUBMODULES - do - echo -e "\t${green}modified:\t$SUB${no_color}" - done - echo - echo -e "${red}Aborting commit due to submodule update. Please unstage the submodule(s) and commit again.${no_color}" - exit 1 -else - echo "No submodules in commit, continuing..." - exit 0 -fi diff --git a/.github/hooks/pre-push b/.github/hooks/pre-push deleted file mode 100755 index 998625467bc..00000000000 --- a/.github/hooks/pre-push +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -[ -n "$CI" ] && exit 0 - -UPSTREAM=${GHOST_UPSTREAM:-origin} -GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) - -# $1 is the name of the remote to which the push is being done -if [ "$1" = "$UPSTREAM" ] && [ "$GIT_BRANCH" = "main" ]; then - printf "ℹ️ Pushing to \033[0;32m$GIT_BRANCH\033[0m branch requires some checks in advance\n" - - yarn lerna run --include-dependents --since $1/$GIT_BRANCH test:unit -fi