Skip to content

fix(vercel): drop fragile VERCEL_GIT_PULL_REQUEST_ID guard in ignore step#3404

Merged
koala73 merged 1 commit into
mainfrom
fix/vercel-ignore-pr-id-fragile
Apr 25, 2026
Merged

fix(vercel): drop fragile VERCEL_GIT_PULL_REQUEST_ID guard in ignore step#3404
koala73 merged 1 commit into
mainfrom
fix/vercel-ignore-pr-id-fragile

Conversation

@koala73

@koala73 koala73 commented Apr 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • scripts/vercel-ignore.sh skipped any preview where VERCEL_GIT_PULL_REQUEST_ID was empty. Vercel leaves that var unset on manual "Redeploy" / "Redeploy without cache" actions and some integration edge cases — even when the commit is clearly attached to an open PR — so legitimate previews silently canceled.
  • The merge-base diff against origin/main immediately below the deleted guard is already the authoritative "did this branch touch anything web-relevant" check and is strictly stronger: branches with no web changes still skip via that diff; branches with web changes build whether or not Vercel happens to know about a PR association at deploy time.
  • Comment block expanded to record the failure mode so the guard isn't reintroduced.

Repro

PR #3403 (feat/usage-telemetry) commit 24d511e29 modified five api/ + server/ files. Vercel canceled at the ignore step:

Running "bash scripts/vercel-ignore.sh"
The Deployment has been canceled as a result of running the command defined in the "Ignored Build Step" setting.

Local replay with VERCEL_GIT_PULL_REQUEST_ID and VERCEL_GIT_PREVIOUS_SHA unset and VERCEL_GIT_COMMIT_REF=feat/usage-telemetry:

  • Before this PR: exit 0 (skip — wrong)
  • After this PR: exit 1 (build — correct)

Test plan

  • bash -n scripts/vercel-ignore.sh (syntax)
  • Local replay against 24d511e29 with PR_ID unset → exits 1
  • After merge: feat/usage-telemetry next push (or rebase) deploys preview
  • Negative: a docs-only branch with no api//server//src/ changes still gets skipped

…step

scripts/vercel-ignore.sh skipped any preview deploy where
VERCEL_GIT_PULL_REQUEST_ID was empty. Vercel only populates that var
on fresh PR-aware webhook events; manual "Redeploy" / "Redeploy
without cache" from the dashboard, and some integration edge cases,
leave it empty even on commits attached to an open PR. The merge-base
diff against origin/main below it is already the authoritative
"touched anything web-relevant" check and is strictly stronger.

Repro: PR #3403 commit 24d511e on feat/usage-telemetry — five api/
+ server/ files clearly modified, build canceled at line 18 before
the path diff ran. Local replay with PR_ID unset now exits 1 (build).
@vercel

vercel Bot commented Apr 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
worldmonitor Ready Ready Preview, Comment Apr 25, 2026 1:50pm

Request Review

@greptile-apps

greptile-apps Bot commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Removes the VERCEL_GIT_PULL_REQUEST_ID guard that was causing legitimate preview deployments to be silently canceled whenever Vercel did not set the variable (manual redeployments, some integration edge cases). The merge-base diff against origin/main is now the sole gate, which is strictly correct: branches with no web-relevant changes still skip, and branches with web changes always build regardless of Vercel's PR-awareness at deploy time.

Confidence Score: 5/5

Safe to merge — targeted one-line removal with well-documented rationale and no new logic introduced.

The change removes a single fragile guard and replaces it with nothing — the pre-existing merge-base diff check already handles every case correctly. The author has verified the fix locally and documented the failure mode thoroughly in comments. No new code paths, no security surface, no risk of regressions beyond the intentional change in behavior (non-PR branches with web changes now build, which is the correct outcome).

No files require special attention.

Important Files Changed

Filename Overview
scripts/vercel-ignore.sh Removes the VERCEL_GIT_PULL_REQUEST_ID early-exit guard; expands comment block to document the failure mode and the rationale for relying solely on the merge-base diff. Logic is correct and well-explained.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Vercel Ignored Build Step triggered] --> B{VERCEL_GIT_COMMIT_REF == main?}
    B -- Yes --> C{VERCEL_GIT_PREVIOUS_SHA set and valid?}
    C -- Yes --> D{Web-relevant paths changed on main?}
    D -- No --> E[exit 0 — skip build]
    D -- Yes --> F[exit 1 — build]
    C -- No --> F
    B -- No preview branch --> G_REMOVED["REMOVED: exit 0 if VERCEL_GIT_PULL_REQUEST_ID empty"]
    G_REMOVED -. was here .-> H
    B -- No preview branch --> H{git merge-base HEAD origin/main succeeds?}
    H -- Yes --> I[COMPARE_SHA = merge-base]
    H -- No --> J{VERCEL_GIT_PREVIOUS_SHA set and valid?}
    J -- Yes --> K[COMPARE_SHA = PREVIOUS_SHA]
    J -- No --> F
    I --> L{Web-relevant paths changed vs COMPARE_SHA?}
    K --> L
    L -- Yes --> F
    L -- No --> E
Loading

Reviews (1): Last reviewed commit: "fix(vercel): drop fragile VERCEL_GIT_PUL..." | Re-trigger Greptile

@koala73
koala73 merged commit eeffac3 into main Apr 25, 2026
11 checks passed
@koala73
koala73 deleted the fix/vercel-ignore-pr-id-fragile branch April 25, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant