Skip to content

Commit

Permalink
pre-commit test
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmoffet committed Nov 15, 2024
1 parent c664ef9 commit 908eca4
Show file tree
Hide file tree
Showing 9 changed files with 3,417 additions and 15 deletions.
9 changes: 9 additions & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title = "Gitleaks development"
[extend]
useDefault = true

[allowlist]
paths = [
'''.env''',
'''.secrets.baseline'''
]
26 changes: 21 additions & 5 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,29 @@ git rm -r --cached build/ >/dev/null 2>&1 || true
(while sleep 1; do printf '.'; done) &
spinner_pid=$!

echo "Scanning all commits... 30-60s 💅🥱⏳"
# Run the gitleaks command
gitleaks detect -v
echo "Scanning commit... 30-60s 💅🥱⏳"

# Exit on any error
set -e

# Ensure cleanup happens even if script fails
cleanup() {
echo "Detected secrets in staged files!"
kill $spinner_pid
}

if ! gitleaks protect --staged -v --redact; then
cleanup
exit 1
fi

if ! git diff --staged --name-only -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline; then
cleanup
exit 1
fi

# Once gitleaks completes, stop the animation
kill $spinner_pid
# wait $spinner_pid 2>/dev/null

npm install
npm run format
npm run i18n:parse
Loading

0 comments on commit 908eca4

Please sign in to comment.