mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-04-26 01:24:59 +02:00
* ci: skip typecheck for scripts-only PRs; fix vercel-ignore empty SHA Typecheck workflow: - Add paths-ignore for scripts/** and .github/** on pull_request and push. Seed scripts are plain .mjs — not TypeScript — so typechecking adds ~2min with zero coverage benefit for scripts-only changes. vercel-ignore.sh: - When VERCEL_GIT_PREVIOUS_SHA is empty or invalid (can happen on incremental PR pushes), fall back to git merge-base HEAD origin/main instead of defaulting to exit 1 (build). This was causing Vercel to deploy on scripts-only PRs even though the ignore script correctly excludes scripts/ from web-relevant paths. * fix(ci): remove .github/** from typecheck paths-ignore to unblock PR
49 lines
1.7 KiB
Bash
Executable File
49 lines
1.7 KiB
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.
|
|
|
|
# On main: skip if ONLY scripts/, docs/, .github/, or non-web files changed
|
|
if [ "$VERCEL_GIT_COMMIT_REF" = "main" ] && [ -n "$VERCEL_GIT_PREVIOUS_SHA" ]; then
|
|
git cat-file -e "$VERCEL_GIT_PREVIOUS_SHA" 2>/dev/null && {
|
|
WEB_CHANGES=$(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' | head -1)
|
|
[ -z "$WEB_CHANGES" ] && echo "Skipping: no web-relevant changes on main" && exit 0
|
|
}
|
|
exit 1
|
|
fi
|
|
|
|
# Skip preview deploys that aren't tied to a pull request
|
|
[ -z "$VERCEL_GIT_PULL_REQUEST_ID" ] && exit 0
|
|
|
|
# Resolve comparison base: prefer VERCEL_GIT_PREVIOUS_SHA, fall back to merge-base with main
|
|
# (empty/invalid PREVIOUS_SHA caused false "build" on PRs that only touch scripts/)
|
|
COMPARE_SHA="$VERCEL_GIT_PREVIOUS_SHA"
|
|
if [ -z "$COMPARE_SHA" ] || ! git cat-file -e "$COMPARE_SHA" 2>/dev/null; then
|
|
COMPARE_SHA=$(git merge-base HEAD origin/main 2>/dev/null)
|
|
fi
|
|
[ -z "$COMPARE_SHA" ] && exit 1
|
|
|
|
# Build if any of these web-relevant paths changed
|
|
git diff --name-only "$COMPARE_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
|