From 333a95db4e756f9ebf573e4b55d7d7b5a4de74e5 Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 9 Sep 2022 15:17:21 -0700 Subject: [PATCH] #10310 run yarn pre-commit only if static files changed --- scripts/git-hooks/pre-commit | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/git-hooks/pre-commit b/scripts/git-hooks/pre-commit index 7a3d680a4..dd3645eda 100755 --- a/scripts/git-hooks/pre-commit +++ b/scripts/git-hooks/pre-commit @@ -41,9 +41,13 @@ if [ $? != 0 ]; then fi echo "Checking UI ESLint, TypeScript, and Prettier compliance..." -yarn --cwd "$PWD/netbox/project-static" validate -if [ $? != 0 ]; then - EXIT=1 +git diff --cached --name-only | if grep --quiet 'netbox/project-static/' +then + echo "Checking UI ESLint, TypeScript, and Prettier compliance..." + yarn --cwd "$PWD/netbox/project-static" validate + if [ $? != 0 ]; then + EXIT=1 + fi fi if [ $EXIT != 0 ]; then