async function findPreviousComment()

in index.js [229:245]


async function findPreviousComment(text) {
  if (!octokit) {
    return null;
  }
  core.info('find comment');
  const { data: comments } = await findCommentsForEvent();

  const vercelPreviewURLComment = comments.find(comment =>
    comment.body.startsWith(text),
  );
  if (vercelPreviewURLComment) {
    core.info('previous comment found');
    return vercelPreviewURLComment.id;
  }
  core.info('previous comment not found');
  return null;
}