Skip to content

Deploy Preview

Deploy Preview #216

name: Deploy Preview
on:
workflow_run:
workflows: ['Build Preview Deployment']
types:
- completed
permissions:
actions: read
deployments: write
contents: read
pull-requests: write
jobs:
deploy-preview:
runs-on: ubuntu-latest
if: >-
${{
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.head_repository.fork == true
}}
name: Deploy Preview to Cloudflare Pages (Fork PRs)
environment:
name: preview-fork-approval
url: ${{ steps.cloudflare-preview-deploy.outputs.alias || steps.cloudflare-preview-deploy.outputs.url }}
steps:
- name: Download build artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
id: preview-build-artifact
with:
name: preview-build
path: build
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Deploy to Cloudflare Pages
id: cloudflare-preview-deploy
uses: AdrianGonz97/refined-cf-pages-action@45ea15c1c69a7bce8ffbb79ba114daa2b52f0cff # v1.3.0
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
projectName: ${{ vars.CF_PAGES_PROJECT_NAME }}
deploymentName: Preview
directory: ${{ steps.preview-build-artifact.outputs.download-path }}