I want to determine if a pull request is approved or not, as per the “Changes approved” UI on a pull request. I thought this would be easy, but it does not appear to be:
- The v4 PullRequest object does not have this state as a field: https://developer.github.com/v4/object/pullrequest/ (near misses: state, which only says if it’s open/closed/merged; mergeable, which just talks about Git merge state; mergeStateStatus, same thing)
- The v4 PullRequest has a ‘reviews’ connection; thus, in principle, we can manually iterate through the list of review events and manually figure out what the current state is. However, not all approvals are equal: Git UI distinguishes between reviews from those with “write access” and those without. There is no easy way to determine write access in a single GraphQL query here as we retrieve reviews. A near miss is authorAssociation, but e.g. on https://github.com/pytorch/pytorch/pull/21906 I have empirically determined that it classifies people both with and without write access as CONTRIBUTOR, which is not appropriate.
- The v3 Pull Request payload doesn’t appear to have relevant data: https://developer.github.com/v3/pulls/#get-a-single-pull-request
I /really really/ don’t want to be manually fetching and maintaining a list of people with write access. Is there really no direct way to do this?