1
0
Fork 0

chore: Added logic to skip build script

This commit is contained in:
Joost De Cock 2023-05-22 11:24:16 +02:00
parent d10ef18e7a
commit b1d2d5a21b

View file

@ -1,6 +1,8 @@
import process from 'node:process' import process from 'node:process'
import { execSync } from 'child_process' import { execSync } from 'child_process'
const branchesToNeverBuild = ['i18n']
export const shouldSkipBuild = (siteName, checkFolders = '../shared .') => { export const shouldSkipBuild = (siteName, checkFolders = '../shared .') => {
console.log('Skip build script version 1.1.0') console.log('Skip build script version 1.1.0')
@ -23,6 +25,11 @@ export const shouldSkipBuild = (siteName, checkFolders = '../shared .') => {
process.exit(1) process.exit(1)
} }
// Do not build branches that should never be build
for (const skip of branchesToNeverBuild) {
if (branch.match(skip)) return process.exit(1)
}
// Do not build commits that have [vercel skip] in the message // Do not build commits that have [vercel skip] in the message
if (process.env.VERCEL_GIT_COMMIT_MESSAGE.match(/\[vercel skip\]/)) { if (process.env.VERCEL_GIT_COMMIT_MESSAGE.match(/\[vercel skip\]/)) {
console.log('🛑 - Commit message includes [vercel skip] - Do not build') console.log('🛑 - Commit message includes [vercel skip] - Do not build')