Skip to content

Instantly share code, notes, and snippets.

@honeyankit
Created April 15, 2023 00:38
Show Gist options
  • Save honeyankit/7231afc604f9779d1793174181d630f1 to your computer and use it in GitHub Desktop.
Save honeyankit/7231afc604f9779d1793174181d630f1 to your computer and use it in GitHub Desktop.
graphQL-query
Query to get CI status of the repo using only repo.id
@honeyankit
Copy link
Author

honeyankit commented Apr 15, 2023

I used the below graphQL to query in the explorer the CI status using only repo.id

query($repo_id: ID!) {
  node(id: $repo_id) {
    ... on Repository {
      defaultBranchRef {
        target {
          ... on Commit {
            history(first: 25) {
              edges {
                node {
                  status {
                    __typename
                  }
                  checkSuites(first: 50) {
                    edges {
                      node {
                        checkRuns(first: 50) {
                          edges {
                            node {
                              status
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
 { "repo_id": "R_kgDOAMemFA" }

@honeyankit
Copy link
Author

Query to get the repo id:

# Type queries into this side of the screen, and you will 
# see intelligent typeaheads aware of the current GraphQL type schema, 
# live syntax, and validation errors highlighted within the text.

# We'll get you started with a simple query showing your username!
query {
  repository(owner: "owner_name", name: "xyz") {
    id
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment