From 9550af3011c31590c3be2a1e634b9cecdebc9610 Mon Sep 17 00:00:00 2001 From: marocchino Date: Sat, 23 Nov 2019 10:44:40 +0900 Subject: [PATCH] feat: find & write with comment header --- src/comment.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/comment.ts b/src/comment.ts index 78504db..7497acc 100644 --- a/src/comment.ts +++ b/src/comment.ts @@ -1,21 +1,23 @@ +const HEADER = ""; + export async function findPreviousComment(octokit, repo, issue_number) { const { data: comments } = await octokit.issues.listComments({ ...repo, issue_number }); - return comments.find(comment => comment.user.login === "github-actions[bot]"); + return comments.find(comment => comment.body.startsWith(HEADER)); } export async function updateComment(octokit, repo, comment_id, body) { await octokit.issues.updateComment({ ...repo, comment_id, - body + body: `${HEADER}\n${body}` }); } export async function createComment(octokit, repo, issue_number, body) { await octokit.issues.createComment({ ...repo, issue_number, - body + body: `${HEADER}\n${body}` }); }