From 06ad50c4ee7b3883895f9dc316ca7fb264e1b613 Mon Sep 17 00:00:00 2001 From: Nick Vigilante Date: Wed, 28 Oct 2026 11:04:53 -0400 Subject: [PATCH] fix(ci): omit empty pr_number meta from preview deploys A preview dispatched by hand has no pull request, and Vercel now rejects the deploy with "meta.pr_number should NOT be shorter than 1 characters". Pass the pr_number meta only when one was given. Assisted-by: AI --- .github/workflows/docs-pr-preview.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docs-pr-preview.yml b/.github/workflows/docs-pr-preview.yml index fddef9eb..1ce07454 100644 --- a/.github/workflows/docs-pr-preview.yml +++ b/.github/workflows/docs-pr-preview.yml @@ -318,12 +318,14 @@ jobs: rm -rf "$stage" mkdir -p "$stage/.vercel" "$stage/$VERCEL_ROOT_DIRECTORY" mv .vercel/output "$stage/.vercel/output" + meta=(--meta content_repository="$CONTENT_REPOSITORY" --meta content_ref="$CONTENT_REF") + # Vercel rejects an empty meta value. + if [[ -n "$PR_NUMBER" ]]; then + meta+=(--meta pr_number="$PR_NUMBER") + fi stop=$(openssl rand -hex 16) echo "::stop-commands::${stop}" - url=$(pnpm exec vercel deploy --cwd "$stage" --prebuilt --target=preview --archive=tgz --yes \ - --meta content_repository="$CONTENT_REPOSITORY" \ - --meta content_ref="$CONTENT_REF" \ - --meta pr_number="$PR_NUMBER") + url=$(pnpm exec vercel deploy --cwd "$stage" --prebuilt --target=preview --archive=tgz --yes "${meta[@]}") echo "::${stop}::" [[ "$url" =~ ^https://[A-Za-z0-9.-]+$ ]] || { echo "the Vercel CLI did not print a deployment URL" >&2; exit 1; } echo "url=$url" >> "$GITHUB_OUTPUT"