From 21f26a02675f3bcec9d8a9c1ae290d01a24bad98 Mon Sep 17 00:00:00 2001 From: Ajit Pratap Singh Date: Tue, 20 Oct 2026 12:58:39 +0530 Subject: [PATCH] fix(website/ci): build when the previous Vercel commit is unavailable vercel-ignore.sh ran git diff against VERCEL_GIT_PREVIOUS_SHA. After a force-push that commit no longer exists in Vercel's clone, git diff exits 128 ("fatal: bad object"), and Vercel fails the deployment for any exit code other than 0/1. Build when the previous commit cannot be resolved, and map every non-skip outcome to exit 1. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KTj1PEbxzVCETkeYrZKcrE --- website/scripts/vercel-ignore.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/website/scripts/vercel-ignore.sh b/website/scripts/vercel-ignore.sh index 756a15a4..f5d0aa9d 100755 --- a/website/scripts/vercel-ignore.sh +++ b/website/scripts/vercel-ignore.sh @@ -1,11 +1,24 @@ #!/usr/bin/env bash # Vercel "Ignored Build Step" (see website/vercel.json). -# Exit 0 = skip the build, exit 1 = build. Vercel's working directory is website/. +# Exit 0 = skip the build, exit 1 = build. Any other exit code makes Vercel +# fail the deployment, so every error path below must end in exit 1 (build). +# Vercel's working directory is website/. # - Production always builds. # - A preview whose commit message contains "[vercel skip]" is skipped (deploy budget). # - Otherwise build only when website/, docs/ or CHANGELOG.md changed. +# - If the previous deployed commit is unavailable (e.g. the branch was +# force-pushed, or it is outside Vercel's shallow clone), build. if [ "$VERCEL_ENV" = "production" ]; then exit 1; fi case "$VERCEL_GIT_COMMIT_MESSAGE" in *'[vercel skip]'*) echo 'Preview skipped: [vercel skip] in commit message'; exit 0 ;; esac -git diff --quiet "${VERCEL_GIT_PREVIOUS_SHA:-HEAD^}" HEAD -- . ../docs ../CHANGELOG.md +prev="${VERCEL_GIT_PREVIOUS_SHA:-HEAD^}" +if ! git cat-file -e "${prev}^{commit}" 2>/dev/null; then + echo "Previous commit ${prev} is not available; building" + exit 1 +fi +if git diff --quiet "$prev" HEAD -- . ../docs ../CHANGELOG.md; then + echo 'Preview skipped: no changes under website/, docs/ or CHANGELOG.md' + exit 0 +fi +exit 1