Closed iainlane closed 4 months ago
I was reviewing our logs when working on #794 earlier and noticed a lot of instances of this message
failed to create evaluation context: failed to load pull request details: Could not resolve to a PullRequest with the number of <implausibly low number>
this turned out to be the reason!
We are notified about check run completions via the
check_run
webhook event. This event contains apull_requests
field, which is a list of PRs that contain the SHA which just got checked:However (mainly but not exclusively), in the case of public repositories, this list can contain PRs in other repositories:
...this is because people can fork the repository and then create PRs from our repo into theirs. These PRs will contain SHAs from our repository and this causes them to appear in the
pull_requests
list of the check run, since they will share the same check run status in any repo: the check run is attached to the commit itself.These PRs should be ignored for our purposes. We aren't evaluating a policy on the remote repo. When a
check_run
completes, we are only interested in PRs for our own repo.