MCPcopy Index your code
hub / github.com/promptfoo/promptfoo / toReviewComment

Function toReviewComment

code-scan-action/src/main.ts:398–416  ·  view source on GitHub ↗
(comment: Comment)

Source from the content-addressed store, hash-verified

396}
397
398function toReviewComment(comment: Comment) {
399 // GitHub's createReview API requires start_line < line for multi-line comments and
400 // rejects the entire review (422) otherwise. Comments routed here are clamped upstream
401 // by partitionReviewCommentsByDiff, but guard explicitly so this never depends on a
402 // caller having run that clamp. The ternary also narrows startLine to `number`,
403 // dropping the null/undefined the API type rejects.
404 const startLine =
405 comment.startLine && comment.line && comment.startLine < comment.line
406 ? comment.startLine
407 : undefined;
408 return {
409 path: comment.file!,
410 line: comment.line || undefined,
411 start_line: startLine,
412 side: 'RIGHT' as const,
413 start_side: startLine ? ('RIGHT' as const) : undefined,
414 body: buildCommentBody(comment),
415 };
416}
417
418async function postReview(
419 octokit: ReturnType<typeof github.getOctokit>,

Callers

nothing calls this directly

Calls 1

buildCommentBodyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…