API v3: What causes a check run/suite pull request field to be empty?

I’m getting check run and check suite events without any pull requests associated with them. What does this mean and what causes it? I would have thought check runs and check suites are tightly coupled to pull requests.

Any insight is greatly appreciated.

As stated in the documentation, check runs and suites are associated with a commit:

A check suite is a collection of the check runs created by a single GitHub App for a specific commit.

While one of the places where they are easiest to see in the GitHub UI is on a pull request, they’re tightly coupled to commits and not branches or PRs.

I hope that helps!

1 Like

It would be very helpful if there was a documented way to retrieve this information. In my use case I want to verify the commit messages and parse them to do some verification. The Pull Request contains a commits_url which I can use to get the commits compared to base. While I see a commit sha, I can’t find anything that tells me against which base this was submitted.

1 Like

@daanikus through our company we filed a support issue with GitHub that I hope we get a response to soon. In summary I can confirm the behavior that you are seeing and can also provide repro steps. 

The issue is that the check run/suite pull request property is  only  populated with values on the very initial Pull Request creation step. If you do any other commits to that branch, after the PR was created, the check run/suite events pull_requests property will be empty for each of commit shas’ check runs/suites. You can confirm this pretty easily by taking a close look at the events submitted to your web hook/github app, and it definitely seems like a  bug on their side. We are using GitHub Enterprise 2.16.4 here and based on their change log from 2.16 -> 2.18, it doesn’t seem they have specifically addressed this issue or just haven’t documented it.