Sub topic 8
Submitting a review: comment, approve, or request changes
This chapter assumes you can open a pull request and leave line comments in the diff. It covers the step that finishes a review: choosing a verdict.
How a review is submitted
Line comments you write in the Files changed tab are not sent one by one when you choose Start a review. GitHub holds them as pending and visible only to you. When you finish, you click Review changes, write an optional summary, pick one of three outcomes, and submit. The author receives everything as a single review.
The three outcomes
| Outcome | Meaning | Effect on merging |
|---|---|---|
| Comment | General feedback, with no decision. | None. |
| Approve | You are satisfied with the change. | Counts toward required approvals. |
| Request changes | The change should not merge as it stands. | Blocks merging if branch protection requires approving reviews. |
Choose Comment when you have questions or non-blocking notes. Choose Approve when you would be comfortable seeing the code ship. Choose Request changes only for problems that must be fixed, such as a bug, a missing test, or a security issue. Style preferences rarely justify it.
What a verdict does after submission
A review verdict belongs to the commit that was current when you submitted it. Two behaviors follow from that:
- If the author pushes follow-up commits, your earlier Request changes stays in place until you submit a new review, or until someone with write access dismisses it.
- A repository can enable Dismiss stale pull request approvals when new commits are pushed. Approvals are then removed after each push, so you must approve again.
Dismissing a review needs a written reason, which is recorded in the conversation.
Submitting from the command line
The gh CLI submits the same three verdicts.
gh pr review 123 --comment --body "Two questions about the retry logic."
gh pr review 123 --request-changes --body "Please add a test for the timeout case."
gh pr review 123 --approve--body is required for --comment and --request-changes. It is optional for --approve.
Common errors
- Approve and Request changes are disabled on your own pull request. GitHub does not let you approve or block your own work. You can only comment.
- Comments that never reach the author. Comments left in a pending review are invisible until you submit. If you close the tab without submitting, they stay pending on the pull request.
- Approval that does not unblock the merge. Only approvals from people with write access count toward required reviews. If CODEOWNERS applies, an owner must approve.
- Requesting changes without saying what to change. The author gets a blocked pull request and no direction. Name the fix in the summary or in the line comments.
Exercise
You left five line comments on a colleague's pull request, but they say they see nothing. What most likely happened, and what do you do?
Show answer
The comments are still in a pending review. Open Review changes, choose Comment, Approve, or Request changes, and submit, which sends all five comments at once.
Exercise
A pull request has one approval, then the author pushes a new commit. The merge button is now blocked, although nobody requested changes. Which repository setting explains this?
Show answer
"Dismiss stale pull request approvals when new commits are pushed" is enabled. The push removed the approval, so a reviewer must approve the new commit.