Skip to content

Commit

Permalink
Merge pull request #15 from Sadaf-A/comment/prevent-duplicate-links
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 authored Jul 12, 2024
2 parents f66a14b + bd29d82 commit 22d2f28
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/handle-commit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ export function handleCommit(owner: string, repo: string, commit_sha: string, de
const botComment = data.find((comment) => comment.user?.id === deploysBot.id);
if (botComment) {
// If bot comment exists, update it
return octokit.repos.updateCommitComment({
owner,
repo,
comment_id: botComment.id,
body: botComment.body + "\n" + body,
});
if (!botComment.body.includes(body)) {
return octokit.repos.updateCommitComment({
owner,
repo,
comment_id: botComment.id,
body: botComment.body + "\n" + body,
});
}
} else {
// If bot comment does not exist, create a new one
return octokit.repos.createCommitComment({
Expand Down

0 comments on commit 22d2f28

Please sign in to comment.