-
Notifications
You must be signed in to change notification settings - Fork 0
/
precommit.sh
executable file
·53 lines (43 loc) · 1.43 KB
/
precommit.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# abort on errors
set -e
check_changes() {
if git diff --stat --cached -- "$1" | grep -E "$1"; then
echo "run precommit for $1"
return 0
else
echo "no changes found for $1"
return 1
fi
}
force_run_command="-f"
node_paths=("api/" "github-app/" "cli/" "web/" "prerender/" "vscode/" "docs/" "status/" "emails/" \
"aws/cloudfront/frontend/origin-request/" "aws/cloudfront/frontend/viewer-response/" \
"aws/cloudfront/docs/origin-request/" "aws/cloudfront/docs/viewer-response/" \
"aws/cloudfront/build-cloudfront/" "aws/lambda/update-cloudfront-lambda/" \
"aws/cloudfront/frontend/viewer-request/" "aws/lambda/update-sitemap/" \
"aws/lambda/update-currencies/")
for path in "${node_paths[@]}"
do
if [ "$1" = "$force_run_command" ] || check_changes "$path" ; then
npm run precommit --prefix $path
fi
done
script_paths=("antlr/" "fast/" ) #"nlp/dataprocess/base_library_prediction/" "nlp/dataprocess/inter_library_relation/" \
# "nlp/dataprocess/language/" "nlp/deployment/" "nlp/training/bert/" "nlp/training/inter_library_relation/" "aws/sagemaker/deploy/")
for path in "${script_paths[@]}"
do
if [ "$1" = "$force_run_command" ] || check_changes "$path" ; then
cd "$path"
./precommit.sh
cd -
fi
done
git secrets --scan
# run check for tabs precommit
cd scripts/precommit
./spaces.sh
./line_endings.sh
./check_symlinks.sh
cd -
git add -A