fix(vercel): drop fragile VERCEL_GIT_PULL_REQUEST_ID guard in ignore step#3404
Conversation
…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).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryRemoves the Confidence Score: 5/5Safe 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
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
Reviews (1): Last reviewed commit: "fix(vercel): drop fragile VERCEL_GIT_PUL..." | Re-trigger Greptile |
Summary
scripts/vercel-ignore.shskipped any preview whereVERCEL_GIT_PULL_REQUEST_IDwas 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.origin/mainimmediately 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.Repro
PR #3403 (
feat/usage-telemetry) commit24d511e29modified fiveapi/+server/files. Vercel canceled at the ignore step:Local replay with
VERCEL_GIT_PULL_REQUEST_IDandVERCEL_GIT_PREVIOUS_SHAunset andVERCEL_GIT_COMMIT_REF=feat/usage-telemetry:exit 0(skip — wrong)exit 1(build — correct)Test plan
bash -n scripts/vercel-ignore.sh(syntax)24d511e29with PR_ID unset → exits 1feat/usage-telemetrynext push (or rebase) deploys previewapi//server//src/changes still gets skipped