-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
skip-build.sh
executable file
·26 lines (21 loc) · 1.1 KB
/
skip-build.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
#!/bin/bash
# This script is used to skip the build on Vercel process based on the changes in the repository.
# It depends on the `NEXT_PUBLIC_DEVELOPER_DOCS` environment variable to determine which app to check for changes.
# basically an exit code of 0 means the build will be skipped, and 1 means it will be built.
# read more here:
# - https://vercel.com/docs/projects/overview#ignored-build-step
# - https://vercel.com/guides/how-do-i-use-the-ignored-build-step-field-on-vercel
# diff status for develop-docs + docs content
dev_docs_diff_status=$(git diff HEAD^ HEAD --quiet -- develop-docs; echo $?)
docs_diff_status=$(git diff HEAD^ HEAD --quiet -- docs includes platform-includes ; echo $?)
# have changes occurred outside of the content directories
non_content_diff_status=$(git diff HEAD^ HEAD --name-only | grep -vE '^(docs/|platform-includes/|includes/|develop-docs/)' | wc -l)
# always build on changes in non-content related directories
if [[ $non_content_diff_status -gt 0 ]] ; then
exit 1
fi
if [[ "$NEXT_PUBLIC_DEVELOPER_DOCS" == "1" ]] ; then
exit $dev_docs_diff_status
else
exit $docs_diff_status
fi