Skip to content

Commit 875799b

Browse files
committed
ci(web): run wrangler via pnpm dlx so env vars expand
cloudflare/wrangler-action v3 passes its 'command' input to wrangler without shell expansion, so $DEPLOY_BRANCH ended up being the literal branch name on every deploy. All deploys landed in a preview slot called '$DEPLOY_BRANCH' instead of 'develop', leaving wheels-*.pages.dev production URLs empty and blog/guides/api subdomains returning 404. Swap to a plain 'run:' step that invokes wrangler via pnpm dlx, with env vars routed through the shell properly. Same security posture for untrusted branch names (quoted env expansion, not command interpolation).
1 parent a5d72d0 commit 875799b

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

.github/workflows/web-deploy.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,15 @@ jobs:
5353
run: pnpm --filter @wheels-dev/site-${{ matrix.site }} build
5454

5555
- name: Deploy to Cloudflare Pages
56-
uses: cloudflare/wrangler-action@v3
56+
working-directory: web
5757
env:
58-
# Untrusted inputs — pass via env to prevent command injection
58+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
59+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
60+
# Routed via env to keep untrusted branch names out of the command string.
5961
DEPLOY_BRANCH: ${{ github.head_ref || github.ref_name }}
60-
with:
61-
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
62-
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
63-
command: pages deploy web/sites/${{ matrix.site }}/dist --project-name=wheels-${{ matrix.site }} --branch="$DEPLOY_BRANCH" --commit-hash="$GITHUB_SHA"
62+
SITE: ${{ matrix.site }}
63+
run: |
64+
pnpm dlx wrangler@4.78.0 pages deploy "sites/${SITE}/dist" \
65+
--project-name="wheels-${SITE}" \
66+
--branch="${DEPLOY_BRANCH}" \
67+
--commit-hash="${GITHUB_SHA}"

0 commit comments

Comments
 (0)