name: Upload Preview Deployment on: workflow_run: workflows: ['Build Preview Deployment'] types: - completed branches-ignore: - main 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' name: Deploy Preview to Cloudflare Pages steps: - name: Download artifact uses: dawidd6/action-download-artifact@v3 with: workflow: build-preview.yml name: preview-build path: build run_id: ${{ github.event.workflow_run.id }} if_no_artifact_found: error - name: Deploy to Cloudflare Pages uses: AdrianGonz97/refined-cf-pages-action@v1 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} githubToken: ${{ secrets.GITHUB_TOKEN }} projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }} deploymentName: Preview directory: build