From be9772f4c7d7334ed04e4f0ed576147d07c36048 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Tue, 2 Apr 2024 01:18:16 +0900 Subject: [PATCH 1/2] chore: added every build to the git comment --- .github/workflows/deploy.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4b23b36a..d19c492e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -85,18 +85,25 @@ jobs: // Find the comment to update or create a new one if not found let existingComment = comments.data.find(comment => comment.user.login === 'github-actions[bot]'); - let body = `| Preview Deployment | [${sha}](${{ env.CLAIMABLE_URL }}) |\n| ------------------ | -------- |\n`; - + let body = ''; + // If the comment exists, update its body if (existingComment) { - await github.rest.issues.updateComment({ - owner, - repo, - comment_id: existingComment.id, - body - }); + // Check if the SHA already exists in the comment body to avoid duplicates + if (!existingComment.body.includes(sha)) { + body = existingComment.body + `| [${sha}](${{ env.CLAIMABLE_URL }}) |\n`; + await github.rest.issues.updateComment({ + owner, + repo, + comment_id: existingComment.id, + body + }); + } } else { // Create a new comment if no existing comment is found + body = '| Preview Deployment |\n| ------------------ |\n'; + body += `| [${sha}](${{ env.CLAIMABLE_URL }}) |\n`; + await github.rest.issues.createComment({ owner, repo, From 75fb12028d3f4bbaec374d6371a52970a1727bf7 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Tue, 2 Apr 2024 01:20:36 +0900 Subject: [PATCH 2/2] chore: added every build to the git comment --- .github/workflows/deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d19c492e..ecd951fd 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -103,7 +103,6 @@ jobs: // Create a new comment if no existing comment is found body = '| Preview Deployment |\n| ------------------ |\n'; body += `| [${sha}](${{ env.CLAIMABLE_URL }}) |\n`; - await github.rest.issues.createComment({ owner, repo,