x/build/maintner: store Github pull request data #21086
If we want this to be a tool for wider use (and I think it would be good to do that), we need to store Github pull request data for projects.
Furthermore, we currently get Git commits from Gerrit CL's, we'll need to allow people to specify Github as their primary Git upstream and fetch commits from Github instead of Gerrit, and also to read some of the metadata from Github's API that we currently parse out of the Git commits in Gerrit.
There is some data we need in order to avoid calls to the GitHub API in GerritBot.
Number of commits, base ref, HEAD sha, etc.
It also doesn't support PR comments.
Previously, maintner would track only the Events on an Issue/PullRequest, which missed out on the discussions and approvals that the review process generates. This adds a new struct GitHubReviewEvent to represent the results from the GitHub "pulls/reviews" API. This struct follows the same pattern as the GitHubIssueEvent struct. To accomplish this, a new call has been added to the sync() function: syncReviews, which follows the pattern established with syncEvents(). Finally, this adds an additonal method: ForeachReview which iterates over the GitHubReviewEvents in the given GitHubIssue serially and in chronological order. GitHub API Reference: https://developer.github.com/v3/pulls/reviews/ Updates golang/go#21086 Change-Id: I4f59e154a4e4a8a4b8f2676dea932cf44354c288 Reviewed-on: https://go-review.googlesource.com/c/144699 Reviewed-by: Brad Fitzpatrick <firstname.lastname@example.org>