Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 1 of 2

GraphQL check-runs ?

Hello,

Is it possible to use GraphQL to retrieve check-runs ?

 

For example, I can request check-runs from the REST API this way:

 

curl -H "Accept: application/vnd.github.antiope-preview+json" \
-u X:Y https://api.github.com/repos/rails/rails/commits/a98b9505885d551db18d9fe354d1973b31608318/check-runs

But this GraphQL query (run from https://developer.github.com/v4/explorer/) does not seem to be possible:

 

{
  repository(owner: "rails", name: "rails") {
    defaultBranchRef {
      name
      target {
        ... on Commit {
          id
          history(first: 100) {
            nodes {
              commitUrl
              check-runs [...]
              changedFiles
            }
          }
        }
      }
    }
  }
}

Whereas a similar one, based on status, works fine:

 

{
  repository(owner: "rails", name: "rails") {
    defaultBranchRef {
      name
      target {
        ... on Commit {
          id
          history(first: 100) {
            nodes {
              commitUrl
              status {
                state
                contexts {
                  targetUrl
                }
              }
              changedFiles
            }
          }
        }
      }
    }
  }
}

Thanks for your help!

 

1 Reply
Highlighted
Community Manager
Message 2 of 2

Re: GraphQL check-runs ?

Hi @anthonydahanne,

 

Thank you for being here and our apologies for the delay in response.This part of the schema is currently available for developers to preview. The GraphQL resources under preview cannot be accessed via the Explorer at this time.

 

In the API, statuses and checks are different objects so they need to be fetched separately. As far as I'm aware, you can't fetch checks via the GraphQL API, so you'll need to use the REST API. Here's a link to the relevant documentation on checks:

 

https://developer.github.com/v3/checks/

 

And specifically, you're interested in this:

https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref


Best,
AndreaG

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!