@@ -33,30 +33,38 @@ jobs:
33
33
run-id : ${{ github.event.workflow_run.id }}
34
34
- run : ls -R
35
35
- name : Extract pull request number
36
+ id : pr-number
36
37
run : |
37
38
PR_NUMBER=$(cat __metadata__pull_number.txt)
38
- echo "PR_NUMBER =$PR_NUMBER" >> $GITHUB_ENV
39
+ echo "value =$PR_NUMBER" >> $GITHUB_OUTPUT
39
40
- name : Extract commit hash
41
+ id : commit-hash
40
42
run : |
41
43
COMMIT_HASH=$(cat __metadata__commit_hash.txt)
42
- echo "COMMIT_HASH =$COMMIT_HASH" >> $GITHUB_ENV
43
- - run : echo $PR_NUMBER $COMMIT_HASH
44
+ echo "value =$COMMIT_HASH" >> $GITHUB_OUTPUT
45
+ - run : echo ${{ steps.pr-number.outputs.value }} ${{ steps.commit-hash.outputs.value }}
44
46
- name : Deploy to cloudflare pages
45
47
run : npx wrangler pages deploy ./ --project-name $CLOUDFLARE_PAGES_PROJECT --branch pr-$PR_NUMBER --commit-hash $COMMIT_HASH
46
48
env :
49
+ PR_NUMBER : ${{ steps.pr-number.outputs.value }}
50
+ COMMIT_HASH : ${{ steps.commit-hash.outputs.value }}
47
51
CLOUDFLARE_API_TOKEN : ${{ secrets.CLOUDFLARE_API_TOKEN }}
48
52
CLOUDFLARE_ACCOUNT_ID : ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
49
53
CLOUDFLARE_PAGES_PROJECT : ${{ vars.CLOUDFLARE_PAGES_PROJECT }}
54
+ - name : Find Comment
55
+ uses : peter-evans/find-comment@v3
56
+ id : find-comment
57
+ with :
58
+ token : ${{ secrets.GITHUB_TOKEN }}
59
+ issue-number : ${{ steps.pr-number.outputs.value }}
60
+ comment-author : ' github-actions[bot]'
61
+ body-includes : ' Preview deployed'
50
62
- name : Comment on pull request
51
- uses : actions/github-script @v4
63
+ uses : peter-evans/create-or-update-comment @v4
52
64
with :
53
- github-token : ${{ secrets.GITHUB_TOKEN }}
54
- script : |
55
- const prNumber = process.env.PR_NUMBER;
56
- github.issues.createComment({
57
- issue_number: Number(prNumber),
58
- owner: context.repo.owner,
59
- repo: context.repo.repo,
60
- body: `Preview deployed to https://pr-${prNumber}.dev-angular-jp.pages.dev`
61
- })
65
+ token : ${{ secrets.GITHUB_TOKEN }}
66
+ comment-id : ${{ steps.find-comment.outputs.comment-id }}
67
+ edit-mode : replace
68
+ body : |
69
+ Preview deployed to https://pr-${{ steps.pr-number.outputs.value }}.dev-angular-jp.pages.dev (commit: ${{ steps.commit-hash.outputs.value }})
62
70
0 commit comments