Skip to content

Commit b80379b

Browse files
committed
bundle
1 parent dc1834d commit b80379b

File tree

3 files changed

+42
-9
lines changed

3 files changed

+42
-9
lines changed

dist/index.js

Lines changed: 20 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/scripts/comment.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,33 @@ export const comment = async (
1414
const commentBody = `
1515
## PR Checks Complete\n
1616
${analyzeStr?.output}\n
17-
${codeFormattingStr?.output}\n
18-
${testingStr?.output}\n`;
17+
${codeFormattingStr?.output}
18+
${testingStr?.output}`;
1919
// ## Coverage = ${coverageStr?.output}\n`
2020

21-
await ocotokit.rest.issues.createComment({
21+
const { data: comments } = await ocotokit.rest.issues.listComments({
2222
issue_number: context.issue.number,
2323
owner: context.repo.owner,
2424
repo: context.repo.repo,
25-
body: commentBody,
2625
});
26+
const comment = comments.find((comment) =>
27+
comment.body!.includes("PR Checks Complete"),
28+
);
29+
if (comment) {
30+
await ocotokit.rest.issues.updateComment({
31+
comment_id: comment.id,
32+
owner: context.repo.owner,
33+
repo: context.repo.repo,
34+
body: commentBody,
35+
});
36+
} else {
37+
await ocotokit.rest.issues.createComment({
38+
issue_number: context.issue.number,
39+
owner: context.repo.owner,
40+
repo: context.repo.repo,
41+
body: commentBody,
42+
});
43+
}
2744
return { output: "Comment successful", error: false };
2845
} catch (error) {
2946
if (error instanceof Error) setFailed(error.message);

0 commit comments

Comments
 (0)