diff --git a/sites/dev/skip_build.js b/sites/dev/skip_build.mjs similarity index 100% rename from sites/dev/skip_build.js rename to sites/dev/skip_build.mjs diff --git a/sites/lab/skip_build.mjs b/sites/lab/skip_build.mjs new file mode 100755 index 00000000000..72d98247126 --- /dev/null +++ b/sites/lab/skip_build.mjs @@ -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) diff --git a/sites/lab/skip_build.sh b/sites/lab/skip_build.sh deleted file mode 100755 index 466c0453183..00000000000 --- a/sites/lab/skip_build.sh +++ /dev/null @@ -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; - diff --git a/sites/org/skip_build.js b/sites/org/skip_build.mjs similarity index 100% rename from sites/org/skip_build.js rename to sites/org/skip_build.mjs diff --git a/sites/sanity/skip_build.js b/sites/sanity/skip_build.mjs similarity index 100% rename from sites/sanity/skip_build.js rename to sites/sanity/skip_build.mjs