Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/docs-pr-preview-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ jobs:
}

vc pull --yes --environment=preview
url=$(vc deploy --prebuilt --archive=tgz --yes \
# Explicit, since Vercel makes a project's first deployment production.
url=$(vc deploy --prebuilt --target=preview --archive=tgz --yes \
--meta pr="$PR_NUMBER" \
--meta sha="$SHA")
deployment_id=$(vercel_api "https://api.vercel.com/v13/deployments/${url#https://}?teamId=${VERCEL_ORG_ID}" | jq -er '.id')
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/test-docs-preview-mapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,19 @@ else
failures=$((failures + 1))
fi

# Vercel makes a project's first deployment production, and cleanup can leave
# the preview project with none, so the deploy names its target and never
# promotes.
deploy_cmd=$(grep -F 'vc deploy --prebuilt' "$deploy_workflow" || true)
if [ "$(printf '%s\n' "$deploy_cmd" | grep -c .)" -eq 1 ] &&
grep -qF -- '--target=preview' <<<"$deploy_cmd" &&
! grep -qE -- '--prod\b|--target=production' "$deploy_workflow"; then
echo "PASS: every preview deploy targets preview, never production"
else
echo "FAIL: a preview deploy can land as the project's production deployment"
failures=$((failures + 1))
fi

if [ "$failures" -gt 0 ]; then
echo ""
echo "$failures test(s) failed."
Expand Down
Loading