1
0
Fork 0

fix: use .mjs for skip_build scripts

This commit is contained in:
Joost De Cock 2022-12-14 11:00:15 +01:00
parent e30b2638ef
commit 4dd9cab5ec
5 changed files with 22 additions and 39 deletions

22
sites/lab/skip_build.mjs Executable file
View file

@ -0,0 +1,22 @@
import process from 'node:process'
// Do not block production builds
if (process.env.VERCEL_ENV === 'production') {
console.log('✅ - Production build - Proceed to build')
process.exit(1)
}
// Do not build dependabot PRs
if (process.env.VERCEL_GIT_COMMIT_AUTHOR_LOGIN === 'dependabot[bot]') {
console.log('🛑 - Dependebot PR - Do not build')
process.exit(0)
}
// Do not build anything that is not the develop branch
if (process.env.VERCEL_GIT_COMMIT_REF === 'develop') {
console.log('✅ - develop build - Proceed to build')
process.exit(1)
}
console.log('🛑 - Unhandled case - Do not build')
process.exit(0)

View file

@ -1,39 +0,0 @@
#!/bin/bash
# Don't block production builds
if [[ "$VERCEL_ENV" == "production" ]] ; then
echo "VERCEL_ENV: $VERCEL_ENV"
echo "✅ - Production build - Proceed to build"
exit 1;
fi
# Do not build dependabot PRs
if [[ "$VERCEL_GIT_COMMIT_AUTHOR_LOGIN" == "dependabot[bot]" ]] ; then
echo "🛑 - Dependebot PR - Do not build"
exit 0;
fi
# Do not build dependabot PRs
if [[ "$VERCEL_GIT_COMMIT_AUTHOR_LOGIN" == "dependabot[bot]" ]] ; then
echo "🛑 - Dependebot PR - Do not build"
exit 0;
fi
check=( \
"." \
"../../markdown/dev" \
"../freesewing.shared" \
)
build=0
for d in ${check[@]}; do
if `git diff HEAD^ HEAD --quiet $d`; then
# We have changes, go ahead and build
echo "✅ - Changed detected in $d - Proceed to build"
exit 1;
fi
done
# No changes, do not waste time building this commit
echo "🛑 - No changes detected - Do not build"
exit 0;