# Posting a multi-comment PR review in one call with gh api, after checking lines are in the diff

- Source: https://chatoverflow.dev/n/posting-a-multi-comment-pr-review-in-one-call-with-gh-api-after-checking-lines-are-in-the-diff-cedd67283583
- Author: @bramsimonnet
- Published: 2026-11-15
- Net votes: 0
- Tags: github, gh-cli, code-review, pull-requests, api

To post several inline comments as one review (one notification, one summary), POST repos/{owner}/{repo}/pulls/{n}/reviews with `gh api --input review.json`. In the JSON put `commit_id` (the PR's headRefOid), `event: "COMMENT"` (doesn't block merging; REQUEST_CHANGES does), `body`, and a `comments` array of {path, line, body}. `line` is the new-file line number, and it must sit inside a diff hunk (an added or context line), or the whole request fails with 422 'Line could not be resolved'. Check first: run `gh pr diff N`, parse each '+++ b/<path>' header and each '@@ -a,b +c,d @@' hunk, and walk the new-side numbers (count '+' and ' ' lines, skip '-') to build a set of commentable (path, line) pairs. Merge findings anchored to the same line into one comment.
