@@ -163,10 +163,115 @@ when `mergeable_state` isn't `clean`. `422` when the requested |
| 163 | 163 | merge method is disabled on the repo or when no commits are |
| 164 | 164 | ahead of base. `503` if another merge is in flight. |
| 165 | 165 | |
| 166 | +## Reviews |
| 167 | + |
| 168 | +PR reviews bundle a verdict (`approve`, `request_changes`, or |
| 169 | +`comment`) with optional body and any draft inline comments the |
| 170 | +caller had pending on this PR. |
| 171 | + |
| 172 | +### List reviews |
| 173 | + |
| 174 | +``` |
| 175 | +GET /api/v1/repos/{owner}/{repo}/pulls/{number}/reviews |
| 176 | +``` |
| 177 | + |
| 178 | +Required scope: `repo:read`. Returns submitted reviews in |
| 179 | +creation order. |
| 180 | + |
| 181 | +### Submit a review |
| 182 | + |
| 183 | +``` |
| 184 | +POST /api/v1/repos/{owner}/{repo}/pulls/{number}/reviews |
| 185 | +``` |
| 186 | + |
| 187 | +Required scope: `repo:write`. Policy: `ActionPullReview` — |
| 188 | +reviewers must be repo collaborators with at least write access. |
| 189 | + |
| 190 | +```json |
| 191 | +{ "event": "APPROVE", "body": "looks good to me" } |
| 192 | +``` |
| 193 | + |
| 194 | +`event` is one of `APPROVE`, `REQUEST_CHANGES`, `COMMENT` |
| 195 | +(lowercase accepted too). Submitting `APPROVE` as the PR author |
| 196 | +returns `403`. Submitting attaches every pending inline comment |
| 197 | +the caller authored on this PR. |
| 198 | + |
| 199 | +## Inline review comments |
| 200 | + |
| 201 | +### List |
| 202 | + |
| 203 | +``` |
| 204 | +GET /api/v1/repos/{owner}/{repo}/pulls/{number}/comments |
| 205 | +``` |
| 206 | + |
| 207 | +Required scope: `repo:read`. Returns one entry per inline |
| 208 | +comment with `file_path`, `side`, `original_commit_sha`, |
| 209 | +`original_line`, `original_position`, optional `current_position` |
| 210 | +(absent → outdated), `pending`, `resolved`, and threading via |
| 211 | +`in_reply_to_id`. |
| 212 | + |
| 213 | +### Add |
| 214 | + |
| 215 | +``` |
| 216 | +POST /api/v1/repos/{owner}/{repo}/pulls/{number}/comments |
| 217 | +``` |
| 218 | + |
| 219 | +Required scope: `repo:write`. Policy: `ActionPullReview`. |
| 220 | + |
| 221 | +```json |
| 222 | +{ |
| 223 | + "body": "nit: unused import", |
| 224 | + "file_path": "foo.txt", |
| 225 | + "side": "right", |
| 226 | + "original_commit_sha": "abc123", |
| 227 | + "original_line": 12, |
| 228 | + "original_position": 8, |
| 229 | + "current_position": 8, |
| 230 | + "pending": true |
| 231 | +} |
| 232 | +``` |
| 233 | + |
| 234 | +`pending=true` files a draft that's attached to the next review |
| 235 | +the caller submits. `in_reply_to_id` threads under an existing |
| 236 | +comment and inherits its diff anchor. |
| 237 | + |
| 238 | +## Requested reviewers |
| 239 | + |
| 240 | +### List active |
| 241 | + |
| 242 | +``` |
| 243 | +GET /api/v1/repos/{owner}/{repo}/pulls/{number}/requested_reviewers |
| 244 | +``` |
| 245 | + |
| 246 | +Required scope: `repo:read`. Returns active and historical review |
| 247 | +requests with `dismissed_at` / `satisfied_by_review_id` set when |
| 248 | +applicable. |
| 249 | + |
| 250 | +### Request a reviewer |
| 251 | + |
| 252 | +``` |
| 253 | +POST /api/v1/repos/{owner}/{repo}/pulls/{number}/requested_reviewers |
| 254 | +``` |
| 255 | + |
| 256 | +Required scope: `repo:write`. Policy: `ActionPullReview`. Body: |
| 257 | + |
| 258 | +```json |
| 259 | +{ "user_id": 42 } |
| 260 | +``` |
| 261 | + |
| 262 | +or equivalently `{ "username": "bob" }`. `409` when the user is |
| 263 | +already an active pending reviewer; `422` on unknown user. |
| 264 | + |
| 265 | +### Dismiss a request |
| 266 | + |
| 267 | +``` |
| 268 | +DELETE /api/v1/repos/{owner}/{repo}/pulls/{number}/requested_reviewers |
| 269 | +``` |
| 270 | + |
| 271 | +Required scope: `repo:write`. Same body. Returns `204`; `404` |
| 272 | +when there is no active request for that user. |
| 273 | + |
| 166 | 274 | ## Not yet shipped |
| 167 | 275 | |
| 168 | | -- Reviews (`/pulls/{n}/reviews`) |
| 169 | | -- Review comments (`/pulls/{n}/comments`) |
| 170 | | -- Requested reviewers |
| 171 | 276 | - `PUT /pulls/{n}/update-branch` |
| 172 | 277 | - `PUT /pulls/{n}/auto-merge` |