diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index 8329e41e2..b978fdcbc 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -2,8 +2,12 @@ name: Typecheck on: pull_request: + paths-ignore: + - 'scripts/**' push: branches: [main] + paths-ignore: + - 'scripts/**' jobs: typecheck: diff --git a/scripts/vercel-ignore.sh b/scripts/vercel-ignore.sh index a6d0e1f8e..f174f5969 100755 --- a/scripts/vercel-ignore.sh +++ b/scripts/vercel-ignore.sh @@ -17,11 +17,16 @@ fi # 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 +# 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 "$VERCEL_GIT_PREVIOUS_SHA" HEAD -- \ +git diff --name-only "$COMPARE_SHA" HEAD -- \ 'src/' \ 'api/' \ 'server/' \