Summary
Hi :)
To reduce the waiting time for the builds in our monorepo, we're using an ignore build step script to not build a project if it's not needed. However, Vercel still spends about 15 seconds for each project in the monorepo cloning and running the ignore build step script, because the codebase grew in size.
We would like to reduce those wait times by not cloning the repo on every check. Because 95% of the time, the cloning would not be necessary since we can check the commit metadata (e.g. branch name) to a environment variable to see if we actually need to build a project. So no code is required (besides the script atm).
Note
We want to reduce the time spent cloning, since that takes ~10-15s. So, depending on which project comes first, we have to wait numberOfProjectsBeforeTheCorrectOne * 15s for the intended build to start. Because every project will clone the repo first, and only afterwards execute the script.
We are using Turborepo for our monorepo atm.
Steps to Reproduce
Our current script:
/* eslint-disable no-console */const { VERCEL_GIT_COMMIT_REF, BRANCH_PREFIX } = process.env;console.log(`BRANCH_PREFIX: ${BRANCH_PREFIX}`);console.log(`VERCEL_GIT_COMMIT_REF: ${VERCEL_GIT_COMMIT_REF}`);if ( VERCEL_GIT_COMMIT_REF == 'dev' || VERCEL_GIT_COMMIT_REF == 'main' || VERCEL_GIT_COMMIT_REF.startsWith(`${BRANCH_PREFIX}/`)) { // Proceed with the build console.log('✅ - Build can proceed'); process.exit(1);}// Don't buildconsole.log('🛑 - Build cancelled');process.exit(0);