From 0170eb88ea63dce33a51ce4ef62782c46059e969 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 5 Oct 2026 23:15:25 +0000 Subject: [PATCH] ci: Let the Vercel ignore step fetch master despite the missing origin remote Vercel's build clone has no `origin` remote, so every `git fetch origin` in vercel-ignore.sh failed and the step fell back to building. Add the remote from VERCEL_GIT_REPO_OWNER/SLUG when it is missing. The shallow-clone test now drops `origin` like Vercel does. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01KqTAWD4QnKLcbMukj2phKQ --- website/scripts/vercel-ignore.sh | 6 ++++++ website/scripts/vercel-ignore.test.sh | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/website/scripts/vercel-ignore.sh b/website/scripts/vercel-ignore.sh index b200e414f812..6423083bf11f 100755 --- a/website/scripts/vercel-ignore.sh +++ b/website/scripts/vercel-ignore.sh @@ -34,6 +34,12 @@ skip() { cd "$(git rev-parse --show-toplevel)" || build "cannot find repo root" +# Vercel's clone has no `origin` remote, so every fetch below would fail. Add +# one for the (public) repo; the clone is thrown away after the build. +git remote get-url origin >/dev/null 2>&1 || + { [ -n "${VERCEL_GIT_REPO_OWNER:-}" ] && [ -n "${VERCEL_GIT_REPO_SLUG:-}" ] && + git remote add origin "https://github.com/$VERCEL_GIT_REPO_OWNER/$VERCEL_GIT_REPO_SLUG.git"; } + # Builds if site paths changed between $1 and $2 (or the diff fails); else skips. decide() { local files diff --git a/website/scripts/vercel-ignore.test.sh b/website/scripts/vercel-ignore.test.sh index c77218f6a02c..eabf8cc6f007 100755 --- a/website/scripts/vercel-ignore.test.sh +++ b/website/scripts/vercel-ignore.test.sh @@ -232,10 +232,16 @@ for branch in far-pkg far-site; do clone="$(mktemp -d)" git clone -q --depth=10 --branch "$branch" "file://$origin_repo" "$clone" git -C "$clone" branch -f master HEAD + # Like Vercel's clone: no `origin` remote, so the script must fetch by URL. + git -C "$clone" remote remove origin repo="$clone" want=skip [ "$branch" = far-site ] && want=build - expect "$want" "shallow clone, fork far behind master ($branch)" "$branch" + GIT_CONFIG_COUNT=3 \ + GIT_CONFIG_KEY_2="url.file://$origin_repo.insteadOf" \ + GIT_CONFIG_VALUE_2=https://github.com/test-owner/test-repo.git \ + VERCEL_GIT_REPO_OWNER=test-owner VERCEL_GIT_REPO_SLUG=test-repo \ + expect "$want" "shallow clone without origin, fork far behind master ($branch)" "$branch" repo="$origin_repo" rm -rf "$clone" done