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) <[email protected]>
This commit is contained in:
Gerwin Kuijntjes
2026-04-02 13:44:40 +02:00
co-authored by Claude Opus 4.6
parent a2eed3c38b
commit 6970ea40f3
+18 -1
View File
@@ -5,8 +5,15 @@ on:
branches: ["main"] branches: ["main"]
paths: paths:
- "landing/**" - "landing/**"
pull_request:
paths:
- "landing/**"
workflow_dispatch: workflow_dispatch:
permissions:
contents: read
pull-requests: write
jobs: jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -32,9 +39,19 @@ jobs:
run: npm run build run: npm run build
- name: Deploy to Cloudflare Pages - name: Deploy to Cloudflare Pages
id: deploy
uses: cloudflare/wrangler-action@v3 uses: cloudflare/wrangler-action@v3
with: with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} 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 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