@@ -61,47 +61,16 @@ jobs:
6161 echo "Preview URL: $PREVIEW_URL"
6262
6363 - name : Comment PR with preview link
64- uses : actions/github-script@v7
64+ uses : actions-cool/maintain-one-comment@v3
6565 with :
66- github-token : ${{ secrets.GITHUB_TOKEN }}
67- script : |
68- const previewUrl = '${{ steps.deployment-url.outputs.url }}';
69- const prNumber = context.issue.number;
66+ token : ${{ secrets.GITHUB_TOKEN }}
67+ body : |
68+ 🚀 Cloudflare Workers Preview has been successfully deployed!
7069
71- // Find existing comment
72- const comments = await github.rest.issues.listComments({
73- owner: context.repo.owner,
74- repo: context.repo.repo,
75- issue_number: prNumber,
76- });
70+ **Preview URL:** ${{ steps.deployment-url.outputs.url }}
7771
78- const botComment = comments.data.find(comment =>
79- comment.user.type === 'Bot' &&
80- comment.body.includes('Cloudflare Workers Preview')
81- );
72+ <sub>Built with commit ${{ github.event.pull_request.head.sha }}</sub>
8273
83- const commentBody = `## 🚀 Cloudflare Workers Preview
84-
85- Your preview is ready!
86-
87- **Preview URL:** ${previewUrl}
88-
89- <sub>Built with commit ${context.sha}</sub>`;
90-
91- if (botComment) {
92- // Update existing comment
93- await github.rest.issues.updateComment({
94- owner: context.repo.owner,
95- repo: context.repo.repo,
96- comment_id: botComment.id,
97- body: commentBody
98- });
99- } else {
100- // Create new comment
101- await github.rest.issues.createComment({
102- owner: context.repo.owner,
103- repo: context.repo.repo,
104- issue_number: prNumber,
105- body: commentBody
106- });
107- }
74+ <!-- Cloudflare Preview Comment -->
75+ body-include : ' <!-- Cloudflare Preview Comment -->'
76+ number : ${{ github.event.pull_request.number }}
0 commit comments