gh pr review
Approve a pull request or ask for changes
What it does
gh pr review leaves a review: --approve approves, --request-changes asks for more work, --comment gives feedback without a verdict. The last two need text in --body, so the author knows what to fix.
GitHub will not let you approve your own pull request. Comments on specific lines of code cannot be left from the terminal: open the PR with gh pr view --web for that.
Syntax
gh pr review <number> --approve
gh pr review <number> --request-changes --body "<text>"
gh pr review <number> --comment --body "<text>"Examples
Approve pull request 42
gh pr review 42 --approvesame as:
gh pr review 42 -apr review— leave a review42— the pull request number--approve— approve
Ask for changes on pull request 42 with the comment "Add tests"
gh pr review 42 --request-changes --body "Add tests"same as:
gh pr review 42 -r -b "Add tests",gh pr review 42 --request-changes --body 'Add tests',gh pr review 42 -r -b 'Add tests'pr review 42— review this PR--request-changes— changes needed, too early to merge--body "Add tests"— what to fix; required here
Related commands
- gh pr comment — Comment on a pull request
- gh pr diff — See the changes of a pull request
- gh pr merge — Merge a pull request