Found another bug. When an issue is commented on, we try to get PR information assuming that it's a PR. This needs some work around properly parsing the github webhook response, and not just parse the same thing twice and check for non-nil.
event := PullRequestEventFromJSON(ioutil.NopCloser(bytes.NewBuffer(buf)))
eventIssueComment := IssueCommentFromJSON(ioutil.NopCloser(bytes.NewBuffer(buf)))
The issue comes from here `pr, err := s.getPRFromComment(ctx, *eventIssueComment)`. If this is an issue, then
prGitHub, _, err := s.GithubClient.PullRequests.Get(ctx,
will fail because comment.Issue.Number is for an issue, but we are querying a PR. Which results in an
DEBU[2020-07-09T18:54:11.0501935+05:30] Sending GitHub comment caller="server/github.go:117" comment="Trying to auto merge this PR." issue=14970
ERRO[2020-07-09T18:54:14.0899262+05:30] could not get the latest PR information from github: GET https://api.github.com/repos/mattermost/mattermost-server/pulls/14596: 404 Not Found  caller="server/server.go:242"
Note `GET https://api.github.com/repos/mattermost/mattermost-server/pulls/14596`. 14596 is an issue, but we are querying it as a PR.
Issue created from a message in Mattermost.
No testing required.