@@ -44,19 +44,18 @@ jobs:
4444 firebaseServiceAccount : ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
4545 projectId : cp-algorithms
4646 channelId : live
47-
4847 deploy_github_pages :
4948 runs-on : ubuntu-latest
50- if : github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'
49+ if : github.event.workflow_run.conclusion == 'success'
5150 steps :
5251 - name : Checkout repository
5352 uses : actions/checkout@v3
5453
5554 - name : Download pages
5655 uses : actions/download-artifact@v4
5756 with :
58- run-id : ${{ github.event.workflow_run.id }}
59- github-token : ${{ github.token }}
57+ run-id : ${{ github.event.workflow_run.id }}
58+ github-token : ${{ github.token }}
6059 name : page-build
6160 path : public
6261
@@ -71,21 +70,20 @@ jobs:
7170 github_token : ${{ github.token }}
7271 publish_dir : ./public
7372 publish_branch : gh-pages
74- destination_dir : ${{ github.event.pull_request .number || 'main' }}/
73+ destination_dir : ${{ github.event.workflow_run.pull_requests[0] .number || 'main' }}/
7574
7675 - name : Update or create preview comment
77- if : github.event_name == 'pull_request'
7876 uses : actions/github-script@v6
7977 with :
8078 script : |
81- const prNumber = ${{ github.event.pull_request.number }};
82- const repo = context.repo.repo;
79+ const prNumber = ${{ github.event.workflow_run.pull_requests[0].number }};
8380 const owner = context.repo.owner;
84- const commitSha = context.payload.pull_request.head.sha;
81+ const repo = context.repo.repo;
82+ const commitSha = ${{ github.event.workflow_run.head_sha }};
8583 const baseUrl = `https://${owner}.github.io/${repo}/`;
8684 const previewUrl = `${baseUrl}${prNumber}/`;
8785 const body = `Preview the changes for PR #${prNumber} (${commitSha}) here: [${previewUrl}](${previewUrl})`;
88-
86+
8987 // Retrieve comments for the PR to check if the comment already exists
9088 const { data: comments } = await github.rest.issues.listComments({
9189 owner: owner,
0 commit comments