update github action to only post comment once (#5454)

* update github action

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

---------

Co-authored-by: 49fl <ircsurfer33@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Josh Gomez
2025-02-22 12:21:02 -07:00
committed by GitHub
parent 388371b05d
commit fe31769be5
2 changed files with 16 additions and 6 deletions

View File

@ -26,11 +26,21 @@ jobs:
const issue_number = context.payload.pull_request.number; const issue_number = context.payload.pull_request.number;
const owner = context.repo.owner; const owner = context.repo.owner;
const repo = context.repo.repo; const repo = context.repo.repo;
// Post a comment on the PR const { data: comments } = await github.rest.issues.listComments({
await github.rest.issues.createComment({
owner, owner,
repo, repo,
issue_number, issue_number
body: message, });
});
const commentExists = comments.some(comment => comment.body === message);
if (!commentExists) {
// Post a comment on the PR
await github.rest.issues.createComment({
owner,
repo,
issue_number,
body: message,
});
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB