简体   繁体   中英

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

"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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM