Skip to content

Commit

Permalink
chore: added every build to the git comment
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Apr 1, 2024
1 parent 1ffd93d commit 4a8ad27
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 4a8ad27

Please sign in to comment.