From 4fc24addcb33da69d17f65e66ee14b8d660f55af Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Fri, 4 Jun 2021 11:59:12 -0700 Subject: [PATCH] build: suppress errors in git hooks (#42484) When errors occur in git hooks, we can safely supress them as they are validated on CI. This is primarily coming up as an issue related to needing to reinstall node_modules PR Close #42484 --- .husky/commit-msg | 9 ++++++++- .husky/pre-commit | 9 ++++++++- .husky/prepare-commit-msg | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.husky/commit-msg b/.husky/commit-msg index 1b07f649c82..858ad7dea8c 100755 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,4 +1,11 @@ #!/bin/sh . "$(dirname $0)/_/husky.sh" -yarn -s ng-dev commit-message pre-commit-validate --file $1; +set +e + +yarn -s ng-dev commit-message pre-commit-validate --file $1 2>/dev/null +if [ $? -ne 0 ]; then + echo "WARNING: failed to run commit message validation (ng-dev commit-mesage pre-commit-validate)" +fi + +exit 0; diff --git a/.husky/pre-commit b/.husky/pre-commit index 20b00438db4..6c7dc5f4058 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,11 @@ #!/bin/sh . "$(dirname $0)/_/husky.sh" -yarn -s ng-dev format staged; +set +e +yarn -s ng-dev format staged 2>/dev/null +if [ $? -ne 0 ]; then + echo "WARNING: failed to run file formatting (ng-dev format staged)" +fi + + +exit 0; diff --git a/.husky/prepare-commit-msg b/.husky/prepare-commit-msg index 3a3afe6f32f..382a7bad6b1 100755 --- a/.husky/prepare-commit-msg +++ b/.husky/prepare-commit-msg @@ -1,4 +1,11 @@ #!/bin/sh . "$(dirname $0)/_/husky.sh" -yarn -s ng-dev commit-message restore-commit-message-draft $1 $2; +set +e + +yarn -s ng-dev commit-message restore-commit-message-draft $1 $2 2>/dev/null +if [ $? -ne 0 ]; then + echo "WARNING: failed to attempt to restore commit message draft (ng-dev commit-message restore-commit-message-draft)" +fi + +exit 0;