Files
worldmonitor/scripts/vercel-ignore.sh
Elie Habib 406afb0276 chore(vercel): tighten ignore script to allowlist web-relevant paths (#1427)
Switch from exclusion-based (build everything except docs) to
allowlist-based (only build when src/, api/, server/, config files
change). Skips builds for changes to src-tauri/, docker/, deploy/,
convex/, data/, docs/, e2e/, scripts/, .github/, .claude/, tests/.

With 378 feature branches triggering preview deploys, this should
significantly reduce the 99 build-hours burned in 3 days.
2026-03-11 21:02:48 +04:00

35 lines
904 B
Bash
Executable File

#!/bin/bash
# Vercel Ignored Build Step: exit 0 = skip, exit 1 = build
# Only build when web-relevant files change. Skip desktop, docs, scripts, CI, etc.
# Always build production (main branch)
[ "$VERCEL_GIT_COMMIT_REF" = "main" ] && exit 1
# Skip preview deploys that aren't tied to a pull request
[ -z "$VERCEL_GIT_PULL_REQUEST_ID" ] && exit 0
[ -z "$VERCEL_GIT_PREVIOUS_SHA" ] && exit 1
git cat-file -e "$VERCEL_GIT_PREVIOUS_SHA" 2>/dev/null || exit 1
# Build if any of these web-relevant paths changed
git diff --name-only "$VERCEL_GIT_PREVIOUS_SHA" HEAD -- \
'src/' \
'api/' \
'server/' \
'shared/' \
'public/' \
'blog-site/' \
'pro-test/' \
'proto/' \
'package.json' \
'package-lock.json' \
'vite.config.ts' \
'tsconfig.json' \
'tsconfig.api.json' \
'vercel.json' \
'middleware.ts' \
| grep -q . && exit 1
# Nothing web-relevant changed, skip the build
exit 0