How to approve a pull request on GitHub
Open the pull request, click Files changed, click Review changes, select Approve and click Submit review. From a terminal, run gh pr review NUMBER --approve. You cannot approve your own pull request, and an approval only counts toward a required review if it comes from a person with the right access and is not dismissed as stale.
On github.com
From GitHub's Reviewing proposed changes in a pull request and Approving a pull request with required reviews:
- Open the pull request and click Files changed.
- Look through the changes. You can comment on lines or on whole files, and select Viewed in a file's header when you are done with it.
- Above the changed code, click Review changes.
- Type a comment that summarizes your feedback.
- Select Approve. The other choices are Comment (general feedback) and Request changes.
- Click Submit review.
Pull Request Inbox for GitHub, a plugin for JetBrains IDEs, lists the pull requests waiting for your review across repositories and organizations, and with Pro lets you approve from the IDE.
With the GitHub CLI
From the gh pr review manual, the command takes a pull request number, URL or branch, and without one it reviews the pull request of the current branch:
gh pr review NUMBER --approve -b "Looks good to me"
To approve a pull request in another repository, add -R OWNER/REPO. -F FILE reads the review body from a file, and -r and -c request changes or comment instead.
With the REST API
From GitHub's Create a review for a pull request, send event as APPROVE (the other values are REQUEST_CHANGES and COMMENT):
curl -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer YOUR_TOKEN" \
https://api.github.com/repos/OWNER/REPO/pulls/PULL_NUMBER/reviews \
-d '{"event":"APPROVE","body":"Looks good to me"}'
A fine-grained token needs the Pull requests permission with write access (GitHub's permissions required for fine-grained personal access tokens). More in token permissions to review, comment on and merge pull requests.
Who can approve
- Not the author: GitHub says "Pull request authors cannot approve their own pull requests." You also cannot approve a pull request raised by GitHub Copilot if you assigned Copilot to the related issue. If the review is refused, see GitHub review refused.
- Anyone can submit an approving review, but for the merge requirements the top section of the reviewers list "mostly contains approvals from people with write or admin permissions that count toward merge requirements". Approvals from others are shown in a collapsible section and do not affect whether the pull request can be merged.
- Copilot's approvals appear in the top section, yet its reviews do not count toward those requirements: Copilot review does not count as an approval.
Why an approval may not be enough
From GitHub's About protected branches, a rule can add conditions:
- Dismiss stale pull request approvals when new commits are pushed: when the diff changes, the approving review is dismissed as stale and the pull request needs a new approval. Approve again after the last push. See approvals that do not count.
- Require approval of the most recent reviewable push: the most recent reviewable push must be approved by someone other than the person who pushed it. See approval of the most recent reviewable push.
- Code owners: when a rule requires review from code owners, the code owner must approve pull requests that affect their code. See code owner review required.
- A ruleset can also ask for a particular team: waiting for a team's approval.
- A collaborator with admin, owner or write access who requested changes must submit an approving review before the pull request can merge. See changes requested.
A pending review
GitHub says that before you submit a review, your line comments are pending and only visible to you, and that you can edit them until you submit. Pending comments are not an approval. Click Review changes, choose Approve and click Submit review to send them together with the approval. To cancel a pending review and its comments, click Submit review, then Discard review. Through the API, leaving event blank creates a review in the PENDING state, which is not submitted until you submit it. If GitHub says you already have a pending review, see review refused.
Approving from the IDE
Pull Request Inbox for GitHub, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, shows the pull requests waiting for your review across repositories and organizations, with diffs, viewed marks, conversations, checks and merge checks that say what blocks the merge. All of that is free. Approving or requesting changes with a comment, commenting, replying, resolving and merging (also auto-merge) in the IDE are Pro (US$1.50 a month, with a 30-day trial).
Get it on JetBrains Marketplace
GitHub is a trademark of GitHub, Inc.; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by GitHub, Inc. or JetBrains.
More: Take back an approval · Review required, approvals that do not count · Approval of the most recent reviewable push · Code owner review required · Review refused · Changes requested · Waiting for a team's approval · Copilot review not counted · Token permissions for pull requests · 日本語