From 0aecc0e562ba3bc45a850f2a1cbc1c98964de299 Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Wed, 25 Dec 2024 20:09:56 +0800 Subject: [PATCH] ci[pr-preview]: remove existing comment instead of updating --- .github/workflows/prw-deploy-preview.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/prw-deploy-preview.yml b/.github/workflows/prw-deploy-preview.yml index ee00fc53..e3a9a26f 100644 --- a/.github/workflows/prw-deploy-preview.yml +++ b/.github/workflows/prw-deploy-preview.yml @@ -82,22 +82,21 @@ jobs: ); if (existingComment) { - // Update the existing comment - await github.rest.issues.updateComment({ + // Delete the existing comment + await github.rest.issues.deleteComment({ comment_id: existingComment.id, owner: context.repo.owner, - repo: context.repo.repo, - body: commentBody - }); - } else { - // Create a new comment - await github.rest.issues.createComment({ - issue_number: ${{ env.PR_NUMBER }}, - owner: context.repo.owner, - repo: context.repo.repo, - body: commentBody + repo: context.repo.repo }); } + + // Create a new comment + await github.rest.issues.createComment({ + issue_number: ${{ env.PR_NUMBER }}, + owner: context.repo.owner, + repo: context.repo.repo, + body: commentBody + }); } catch (error) { core.setFailed(`Failed to manage PR comment: ${error.message}`); }