Skip to content

Commit 9c22082

Browse files
committed
feat(reviewer): add "AI can make mistakes" to review verdict
1 parent 8d11623 commit 9c22082

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/reviews/reviewer.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ function commentBody(finding: Finding): string {
5151
return `**${label}${finding.title}**\n\nRule: \`${finding.rule}\`\n\n${finding.explanation}\n\n**Suggested resolution:** ${finding.remediation}${suggestion}`;
5252
}
5353

54+
function reviewDisclaimer(): string {
55+
const maintainer = process.env.GITHUB_REVIEW_MAINTAINER?.replace(/^@/, "");
56+
const escalation = maintainer
57+
? `reply in the relevant thread and mention \`@${maintainer}\``
58+
: "reply in the relevant thread for maintainer review";
59+
return `This is an AI-generated first pass and may be mistaken. If a finding is unclear or incorrect, ${escalation}.`;
60+
}
61+
5462
function sourceContent(
5563
decoded: Buffer,
5664
fileSize: number,
@@ -309,7 +317,7 @@ export async function reviewPullRequest(input: {
309317
const fallback = summaryOnly.length
310318
? `\n\n### Findings without an inline diff location\n\n${summaryOnly.map((finding) => `- **${finding.title}** (\`${finding.path}:${finding.line}\`, ${finding.rule}): ${finding.explanation} ${finding.remediation}`).join("\n")}`
311319
: "";
312-
const body = `${result.summary}${fallback}\n\n---\n_${blockingCount > 0 ? `Automated review found ${blockingCount} publication-blocking issue${blockingCount === 1 ? "" : "s"}.` : "Automated extension review passed. A maintainer review is still required."}_`;
320+
const body = `${result.summary}${fallback}\n\n---\n_${blockingCount > 0 ? `Automated review found ${blockingCount} publication-blocking issue${blockingCount === 1 ? "" : "s"}.` : "Automated extension review passed. A maintainer review is still required."}_\n\n${reviewDisclaimer()}`;
313321
const { data: review } = await octokit.rest.pulls.createReview({
314322
...coordinates,
315323
commit_id: pull.head.sha,

0 commit comments

Comments
 (0)