Skip to content

Get approval status of the pr #1148

Answered by offbyone
thatdevin asked this question in Q&A
Discussion options

You must be logged in to vote

Yep:

repo = g.repository(owner, repo)
pr = repo.pull_request(PR_NUMBER_AS_STRING)
states = [r.state for r in pr.reviews()]

That gets the review statuses.

pr.mergeable and pr.mergeable_state tell you if the PR is able to merge.

Checks are the other approving concept and you can get at those using the commits on the PR:

most_recent_commit = list(pr.commits())[-1]
runs = list(most_recent_commit.check_runs())
statuses = [r.status for r in runs]

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sigmavirus24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1133 on April 26, 2023 00:37.