GraphQL API response for commit status is null #24508
-
Using the GraphQL API Explorer (but also in my own code), and with the following query:
The commit status is always null for private repositories, even though the GraphQL API Explorer has the right access, and some of the first pull requests do return a status. Am I using the wrong query to get the commit status of the last commit for a given PR, or is something else wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 1 reply
-
Hey @pascaldevink! Your query looks right to me! I tested it in a couple of my private repositories and it returned the data that I expected. In your code, are you using a Personal Access Token (PAT)? If so, what scopes does it have? |
Beta Was this translation helpful? Give feedback.
-
Hi @nickvanw, thanks for coming back to me. I’m currently using a personal access token with all the I think I’ve tracked down the root issue: For some repositories, I was able to get all the status information on commits, but for some repositories I was only able to do that up till a certain point. We are using CircleCI in our organisation and in October we’ve switched to using Pull Request Checks. You can probably already guess when the status field stopped giving usefull information by now. I see the checks API is still in beta, but the announcement and documentation only cover V3 of the API. Is there an equivalent in V4? And is there any documentation on it for V4? |
Beta Was this translation helpful? Give feedback.
-
Hey @pascaldevink! I think the GraphQL API may be able to do what you want! There is a
Let me know if that works! |
Beta Was this translation helpful? Give feedback.
-
@nickvanwI am seeing a similar issue, I can see status for private and public repos with no branch protection rules, however, on repos with branch protection rules on I only get null for all status checks in the Graphql API. |
Beta Was this translation helpful? Give feedback.
-
@starefossen hit the same exact issue in a repo with branch protection rules. Were you able to find anything? |
Beta Was this translation helpful? Give feedback.
-
Hello @sfpetersen, thanks for joining us! If you can share the query you’re using, that will generally help people diagnose the problem you’re encountering much, much easier. So if you can share your query, that would be very helpful. |
Beta Was this translation helpful? Give feedback.
-
The specific query I was using is below, though I’m sure I could reproduce it without the associatedPullRequests bit. Thanks!
Interestingly, the “statusCheckRollup” field seems to work fine - but the “status” field is always null. In this specific case, what I’m really looking for is a way to get the result of the “Require branches to be up to date before merging” check. I’m not actually sure if that is broken out in the status field. |
Beta Was this translation helpful? Give feedback.
-
I was unable to reproduce the problem you’re describing. I used the query:
and saw
sfpetersen:
That sounds like a separate question from this entirely. Would you mind opening a new topic for specifically this question @sfpetersen? |
Beta Was this translation helpful? Give feedback.
-
OK yes I will open a new topic when I get a chance. To be clear, I also get |
Beta Was this translation helpful? Give feedback.
-
@lee-dohm I opened a separate topic for the other question: API query to get result of "Require branches to be up to date before merging" branch protection check for a Pull Request. Thanks! |
Beta Was this translation helpful? Give feedback.
Hey @pascaldevink!
I think the GraphQL API may be able to do what you want! There is a
Commit.checkSuites
connection that should get you the names and statuses of CircleCI’s Checks, something like this: