-
Notifications
You must be signed in to change notification settings - Fork 361
/
Copy pathignore.sh
executable file
·41 lines (37 loc) · 1.31 KB
/
ignore.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
#!/usr/bin/env bash
# grab the latest entry from git log
log=$(env -i git log -1 --pretty=%B)
# run a series of checks for common reasons that we shouldn't preview build.
# if no checks match, exit with code 1 to run the build
# Force a build
if echo $log | grep -1 'netlify\-build'; then
echo "Force build becuase Netlify is a benevolent overseer"
exit 1
# make sure we don't build for changes that are not in src/
# elif git diff --quiet $COMMIT_REF $CACHED_COMMIT_REF -- src/; then
# echo "No changes to src/ detected, skipping"
# exit
# # ignore for simple typo fixes
# elif echo "$log" | grep -q 'typo'; then
# echo "Build ignored because 'typo' is in the commit message."
# exit
# # ignore link / url updates
# elif echo "$log" | grep -q 'link'; then
# echo "Build ignored because 'link' is in the commit message."
# exit
# # ignore when the ignore tag is explicitly added
# elif echo "$log" | grep -q 'netlify\-ignore'; then
# echo "Build ignored because it was requested."
# exit
# # ignore dependabot updates
# elif echo "$log" | grep -q 'dependabot'; then
# echo "Ignoring dependabot update"
# exit
# # ignore when master is merged into a branch
# elif echo "$log" | grep -q 'Merge branch \Smaster\S'; then
# echo "Build ignored because it's only an update from the main branch."
# exit
# else
echo "Build skipped"
exit 0
fi