Neo Gónzáles
Neo Gónzáles

Reputation: 231

how to get github pull request all reviewers using python (pyGithub)

I'm using pyGithub to interact with github, i'd like to get all reviewer list for a pull request. There's a api pullrequest.get_review_requests() which only returns people who were asked for review, not returning people who joined as reviewer. Is there any api call i can get full list of reviewer (including people who was asked for review and people who self joined as reviewer)? Thanks. -Neo

Upvotes: 2

Views: 1694

Answers (1)

davegaeddert
davegaeddert

Reputation: 3339

"Reviews" and "review requests" are two different things that you have to combine on your own, as far as I know. One difference though is that "review requests" can be an entire team or a single user. "Reviews" are only associated with a single user.

With PyGitHub I think you'd be looking to do something like this:

usernames_involved = set()

for review in pr.get_reviews():
    usernames_involved.add(review.user.username)

users_requested, teams_requested = pr.get_review_requests()

for user in users_requested:
    usernames_involved.add(user.username)

for team in teams_requested:
    for user in team.get_members():
        usernames_involved.add(user.username)

print(usernames_involved)

Upvotes: 2

Related Questions