2022-12-18 10:00:00 +01:00
|
|
|
import process from 'node:process'
|
|
|
|
|
2022-12-26 14:38:55 +01:00
|
|
|
const branches = ['develop', 'joost']
|
|
|
|
|
2022-12-18 10:00:00 +01:00
|
|
|
// 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
|
2022-12-26 14:38:55 +01:00
|
|
|
if (branches.includes(process.env.VERCEL_GIT_COMMIT_REF)) {
|
|
|
|
console.log('✅ - elected branch build - Proceed to build')
|
2022-12-18 10:00:00 +01:00
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log('🛑 - Unhandled case - Do not build')
|
|
|
|
console.log(` VERCEL_GIT_COMMIT_AUTHOR_LOGIN: ${process.env.VERCEL_GIT_COMMIT_AUTHOR_LOGIN}`)
|
|
|
|
console.log(` VERCEL_GIT_COMMIT_REF: ${process.env.VERCEL_GIT_COMMIT_REF}`)
|
|
|
|
process.exit(0)
|