From f658665d4a6c970c94785bba1a3e1b1ac42232c3 Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Wed, 10 Jun 2026 16:18:41 -0700 Subject: [PATCH] Fix CI deploying all PR preview builds to dev.graphite.art Fixes a regression introduced in 9dccc526b --- .github/workflows/build.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5e353cbc1a..cde93fd7bc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -119,11 +119,21 @@ jobs: echo "No Cloudflare API token available (fork PR), skipping deploy." exit 0 fi + + if [ "${{ github.event_name }}" = "push" ]; then + DEPLOY_BRANCH="master" + else + DEPLOY_BRANCH="${{ inputs.checkout_ref || github.head_ref || github.ref_name }}" + if [ "$DEPLOY_BRANCH" = "master" ] || [ -z "$DEPLOY_BRANCH" ]; then + DEPLOY_BRANCH="preview-${{ github.run_id }}" + fi + fi + MAX_ATTEMPTS=8 DELAY=15 for ATTEMPT in $(seq 1 $MAX_ATTEMPTS); do echo "Attempt $ATTEMPT of $MAX_ATTEMPTS..." - npx wrangler@3 pages deploy "frontend/dist" --project-name="${{ steps.production-env.outputs.cf_project || 'graphite-dev' }}" --branch="master" --commit-dirty=true 2>&1 | tee /tmp/wrangler_output + npx wrangler@3 pages deploy "frontend/dist" --project-name="${{ steps.production-env.outputs.cf_project || 'graphite-dev' }}" --branch="$DEPLOY_BRANCH" --commit-dirty=true 2>&1 | tee /tmp/wrangler_output if [ ${PIPESTATUS[0]} -eq 0 ]; then URL=$(grep -oP 'https://[^\s]+\.pages\.dev' /tmp/wrangler_output | head -1) echo "url=$URL" >> "$GITHUB_OUTPUT"