From 02dd1f0a4563c65223546300ed19799665ad2ced Mon Sep 17 00:00:00 2001 From: Christopher Sellers <1@christophersellers.com> Date: Sun, 25 Oct 2026 22:41:08 -0700 Subject: [PATCH 1/2] ci(vercel): diff ignore step against main merge-base; skip guard for non-frontend PRs The ignore step diffed against VERCEL_GIT_PREVIOUS_SHA (the previous push), so a push that merged main or touched only non-frontend files cancelled the preview on frontend PRs (#3586, #3578, #3553, #3583: 'Canceled by Ignored Build Step'). The guard also failed backend-only PRs (#3599) whose preview is skipped by design. --- .github/workflows/vercel-preview-guard.yml | 25 +++++++++++++++++++++- frontend/scripts/vercel-ignore-build.sh | 20 ++++++----------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.github/workflows/vercel-preview-guard.yml b/.github/workflows/vercel-preview-guard.yml index 21c95ebc0..c80d54b5a 100644 --- a/.github/workflows/vercel-preview-guard.yml +++ b/.github/workflows/vercel-preview-guard.yml @@ -15,15 +15,34 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 26 permissions: + contents: read deployments: read statuses: read checks: read outputs: preview_url: ${{ steps.wait.outputs.preview_url }} steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 + with: + fetch-depth: 0 + + - name: Check frontend scope + id: scope + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + MERGE_BASE=$(git merge-base "$BASE_SHA" "$HEAD_SHA") + DIFF=$(git diff --name-only "$MERGE_BASE" "$HEAD_SHA" -- frontend/) + if [ -n "$DIFF" ]; then + echo "frontend=true" >> "$GITHUB_OUTPUT" + else + echo "frontend=false" >> "$GITHUB_OUTPUT" + fi + - name: Wait for the regengine preview id: wait - if: ${{ !startsWith(github.head_ref, 'dependabot/') }} + if: ${{ !startsWith(github.head_ref, 'dependabot/') && steps.scope.outputs.frontend == 'true' }} uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 env: HEAD_SHA: ${{ github.event.pull_request.head.sha }} @@ -183,6 +202,10 @@ jobs: } throw new Error(`No ready regengine Vercel preview for ${sha} after 25 minutes`); + - name: Preview skipped + if: ${{ steps.scope.outputs.frontend == 'false' }} + run: echo "No frontend changes; Vercel preview intentionally skipped by ignore step." + access-link: name: Preview Access Link needs: preview diff --git a/frontend/scripts/vercel-ignore-build.sh b/frontend/scripts/vercel-ignore-build.sh index 7ce3c5bef..9acb6a95d 100644 --- a/frontend/scripts/vercel-ignore-build.sh +++ b/frontend/scripts/vercel-ignore-build.sh @@ -9,21 +9,13 @@ fi BASE="" -if [ -n "${VERCEL_GIT_PREVIOUS_SHA:-}" ]; then - if git cat-file -e "${VERCEL_GIT_PREVIOUS_SHA}^{commit}" 2>/dev/null; then - BASE="$VERCEL_GIT_PREVIOUS_SHA" - fi -fi - +git fetch --quiet --depth=200 origin main 2>/dev/null || true +BASE="$(git merge-base HEAD FETCH_HEAD 2>/dev/null || true)" if [ -z "$BASE" ]; then - git fetch --quiet --depth=100 origin main 2>/dev/null || true - BASE="$(git merge-base HEAD FETCH_HEAD 2>/dev/null || true)" - if [ -z "$BASE" ]; then - if git cat-file -e origin/main^{commit} 2>/dev/null; then - BASE="origin/main" - elif git rev-parse --verify origin/main >/dev/null 2>&1; then - BASE="origin/main" - fi + if git cat-file -e origin/main^{commit} 2>/dev/null; then + BASE="origin/main" + elif git rev-parse --verify origin/main >/dev/null 2>&1; then + BASE="origin/main" fi fi From 21d0e81c5797201206b92e409f31ca3ce4fe1c5b Mon Sep 17 00:00:00 2001 From: Christopher Sellers <1@christophersellers.com> Date: Sun, 25 Oct 2026 22:57:16 -0700 Subject: [PATCH 2/2] ci(vercel): skip Preview Access Link when no frontend preview URL --- .github/workflows/vercel-preview-guard.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/vercel-preview-guard.yml b/.github/workflows/vercel-preview-guard.yml index c80d54b5a..c028222bd 100644 --- a/.github/workflows/vercel-preview-guard.yml +++ b/.github/workflows/vercel-preview-guard.yml @@ -21,6 +21,7 @@ jobs: checks: read outputs: preview_url: ${{ steps.wait.outputs.preview_url }} + frontend: ${{ steps.scope.outputs.frontend }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 with: @@ -209,6 +210,7 @@ jobs: access-link: name: Preview Access Link needs: preview + if: needs.preview.outputs.frontend == 'true' && needs.preview.outputs.preview_url != '' runs-on: ubuntu-latest timeout-minutes: 5 permissions: