From 6970ea40f3e2fa8829cd624e0adcea99fc382af0 Mon Sep 17 00:00:00 2001 From: Gerwin Kuijntjes Date: Thu, 2 Apr 2026 13:44:40 +0200 Subject: [PATCH] Add Cloudflare Pages preview builds for landing PRs Triggers a preview deployment on pull requests that touch landing/ files. Posts the preview URL as a comment on the PR. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/deploy-landing.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-landing.yml b/.github/workflows/deploy-landing.yml index 1c7f3aa..2738f9e 100644 --- a/.github/workflows/deploy-landing.yml +++ b/.github/workflows/deploy-landing.yml @@ -5,8 +5,15 @@ on: branches: ["main"] paths: - "landing/**" + pull_request: + paths: + - "landing/**" workflow_dispatch: +permissions: + contents: read + pull-requests: write + jobs: deploy: runs-on: ubuntu-latest @@ -32,9 +39,19 @@ jobs: run: npm run build - name: Deploy to Cloudflare Pages + id: deploy uses: cloudflare/wrangler-action@v3 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: pages deploy dist --project-name=pocketgraph-app + command: pages deploy dist --project-name=pocketgraph-app --branch=${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || 'main' }} workingDirectory: landing + + - name: Comment preview URL on PR + if: github.event_name == 'pull_request' + uses: thollander/actions-comment-pull-request@v3 + with: + message: | + 🔍 **Preview deployment ready!** + ${{ steps.deploy.outputs.deployment-url }} + comment-tag: cloudflare-preview