rallytime / tamarack

A bot built with Tornado to automate common pull request tasks. Specifically designed for use with the SaltStack repositories.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve Checking for Reviewers

rallytime opened this issue · comments

Now that it's possible to assign reviewers directly on PRs, the GitHub webhook payload has changed as well. Let's leverage this instead of pulling down the CODEOWNERS file and parsing it. That's extra work we don't need to do.

The team payload looks something like this:

{
  "action": "review_requested",
  "number": 45897,
  "pull_request": {
    "url": "https://api.github.com/repos/saltstack/salt/pulls/45897",
    "id": 167730763,
<snipped>
    "requested_reviewers": [

    ],
    "requested_teams": [
      {
        "name": "team-boto",
        "id": foo,
        "slug": "team-boto",
        "description": "Boto Reviewers",
        <snipped>
      }
    ],
<snipped>
}

So, let's use that list of requested_teams and figure out what requested_reviewers might look like and handle that as well.

The way we're doing this currently is fine and it works, but we can reduce the # of API calls by half if we just use the data in the given webhook payload.

This has been completed, and the work in is the refactor-review-requests branch, but it turns out that this approach won't work as well as I thought it would after testing it. We'll need to stick with the original approach of parsing the CODEOWNERS file.