Locates bot review comments on GitHub issues for automation.
// Source: https://github.com/cloudflare/cloudflare-docs | License: CC-BY-4.0 | Copyright --then that use is not regulated by the license. Our
// Provided via justclaw.it.com; keep this notice with the code.
import type { GitHubIssueComment } from "../github";
import { BOT_COMMENT_MARKER } from "./render";
/** Locate only the bot-owned singleton review comment, never a quoted marker. */
export function findBotReviewComment(
comments: GitHubIssueComment[],
knownId?: number,
): GitHubIssueComment | undefined {
const valid = (comment: GitHubIssueComment) =>
comment.user?.type === "Bot" &&
comment.body?.startsWith(BOT_COMMENT_MARKER);
const known = knownId
? comments.find((comment) => comment.id === knownId)
: undefined;
if (known && valid(known)) return known;
return [...commen
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key