fix(doc-agent): shape review comments for GitHub createReviewComment API

This commit is contained in:
Denis Angell
2026-05-14 10:40:54 +02:00
parent 81d1ce4fb8
commit 5576b4ff34
2 changed files with 13 additions and 3 deletions

View File

@@ -214,9 +214,19 @@ export async function reviewDiff(args: readonly string[]): Promise<void> {
const report = buildReport(files.length, results);
const allIssues = results.flatMap((r) => r.issues);
// Shape inline comments for the GitHub pulls.createReviewComment API,
// which expects `path`/`line`/`body` rather than the internal field names.
const apiComments = allIssues.map((issue) => ({
path: issue.file,
line: issue.line,
body: issue.suggestedDoc
? `**[${issue.severity}]** ${issue.message}\n\n\`\`\`cpp\n${issue.suggestedDoc}\n\`\`\``
: `**[${issue.severity}]** ${issue.message}`,
}));
await writeFile('doc-review-report.md', report);
await writeFile('doc-review-comments.json', JSON.stringify(allIssues, null, 2));
await writeFile('doc-review-comments.json', JSON.stringify(apiComments, null, 2));
console.log('\nReport: doc-review-report.md');
console.log(`Inline comments: doc-review-comments.json (${allIssues.length} issues)`);
console.log(`Inline comments: doc-review-comments.json (${apiComments.length} issues)`);
}

View File

@@ -20,7 +20,7 @@ defaults:
jobs:
review:
if: github.head_ref != 'dangell7/docs'
if: github.head_ref != 'dangell7/docs' && github.head_ref != 'dangell7/docs-full'
runs-on: ubuntu-latest
permissions:
pull-requests: write