(comment: Comment)
| 396 | } |
| 397 | |
| 398 | function 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 | |
| 418 | async function postReview( |
| 419 | octokit: ReturnType<typeof github.getOctokit>, |
nothing calls this directly
no test coverage detected
searching dependent graphs…