Skip to content

Commit 3579521

Browse files
committed
Added PR NR
1 parent 227eb42 commit 3579521

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

.github/workflows/pr-preview-deploy.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ on:
1212

1313
jobs:
1414
deploy:
15+
# workflow_run has no github.event.pull_request; pull_requests[0].number matches
16+
# github.event.pull_request.number from the PR Preview Validate run.
1517
if: >-
1618
github.event.workflow_run.conclusion == 'success' &&
17-
github.event.workflow_run.event == 'pull_request'
19+
github.event.workflow_run.event == 'pull_request' &&
20+
github.event.workflow_run.pull_requests[0].number != null
1821
runs-on: ubuntu-latest
1922
timeout-minutes: 5
2023
environment: Cloudflare Pages
24+
env:
25+
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
2126
permissions:
2227
contents: read
2328
deployments: write
@@ -46,7 +51,7 @@ jobs:
4651
command: >-
4752
pages deploy site
4853
--project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }}
49-
--branch=${{ github.event.workflow_run.head_branch }}
54+
--branch=pr-${{ env.PR_NUMBER }}
5055
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
5156
# - name: Deploy to Cloudflare Pages
5257
# uses: andykenward/github-actions-cloudflare-pages@v3.0.0

0 commit comments

Comments
 (0)