-
Notifications
You must be signed in to change notification settings - Fork 229
Expand file tree
/
Copy pathpre-commit
More file actions
executable file
·24 lines (21 loc) · 912 Bytes
/
pre-commit
File metadata and controls
executable file
·24 lines (21 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
# Invoke the "rush prettier" custom command to reformat files whenever they
# are committed. The command is defined in common/config/rush/command-line.json
# and uses the "rush-prettier" autoinstaller.
node common/scripts/install-run-rush.js prettier || exit $?
ERROR_COLOR='\033[0;31m'
WARNING_COLOR='\033[0;33m'
STOP_COLOR='\033[0m'
if ! command -v gitleaks > /dev/null 2>&1
then
echo "${ERROR_COLOR}\nGitleaks not found. To commit you safely, you need to install it per the instructions at https://github.com/gitleaks/gitleaks.${STOP_COLOR}"
exit 1
elif [ "$SKIP" == "gitleaks" ]
then
echo "${WARNING_COLOR}\nGitleaks skipped for this commit.${STOP_COLOR}"
else
gitleaks protect -v --staged --report-path ./findings.json
fi