From a719eb007b017d55306d9882487573a94e77389e Mon Sep 17 00:00:00 2001 From: Thomas Draier Date: Tue, 5 Nov 2024 21:14:31 +0100 Subject: [PATCH] Gitguardian pre commit hook (#8458) * Add gitguardian precommit hook * installation check --- .husky/pre-commit | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.husky/pre-commit b/.husky/pre-commit index 2e3ecd11ae81..44c33bb37dcf 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -10,6 +10,17 @@ if [ "$current_branch" = "main" ]; then fi fi +if [ -z "$ENABLE_GGSHIELD_ON_COMMIT" ] +then + echo "You can enable secret check by setting ENABLE_GGSHIELD_ON_COMMIT and installing ggshield" +else + if command -v ggshield 2>&1 >/dev/null; then + ggshield secret scan pre-commit "$@" + else + echo "ggshield is not installed. Please install ggshield to enable secret check" + fi +fi + # If env var DUST_LINT_ON_COMMIT = 1, run the linter if [ -z "$DUST_LINT_ON_COMMIT" ]; then echo "Please set DUST_LINT_ON_COMMIT if you want to locally run the lint, type check etc.. before committing."