name: Upload Preview Deployment on: workflow_run: workflows: ['Build Preview Deployment'] types: - completed permissions: actions: write 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.head_repository.full_name == github.repository name: Deploy Preview to Cloudflare Pages steps: - name: Debug Info env: EVENT_JSON: ${{ toJSON(github.event) }} run: | echo "Workflow Run ID: ${{ github.event.workflow_run.id }}" echo "Event Type: ${{ github.event.workflow_run.event }}" echo "Repository: ${{ github.event.workflow_run.head_repository.full_name }}" echo "Full Event: $EVENT_JSON" - name: Download artifacts uses: dawidd6/action-download-artifact@v3 with: workflow: Build Preview Deployment run_id: ${{ github.event.workflow_run.id }} name: preview-build path: build search_artifacts: true - name: List files run: ls -la build - 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