Skip to content

Instantly share code, notes, and snippets.

@tripu tripu/gh-graphql.md
Last active Oct 20, 2018

Embed
What would you like to do?
GH API v4 GraphQL snippets

👉 GH GraphQL API Explorer

My first comments on an issue, on a commit, and on a Gist

{
  viewer {
    issueComments(first: 1) {
      nodes {
        ...commonFields
        url
      }
    }
    commitComments(first: 1) {
      nodes {
        ...commonFields
        url
      }
    }
    gistComments(first: 1) {
      nodes {
        ...commonFields
        gist {
          owner {
            login
          }
          name
        }
      }
    }
  }
}

fragment commonFields on Comment {
  createdAt
  bodyText
}

First 100 W3C repos for which the main language is JS

{
  search(first: 100, type: REPOSITORY, query: "org:w3c language:javascript") {
    repositoryCount
    nodes {
      ... on Repository {
        url
      }
    }
  }
}

All W3C repos with a file “package.json” containing “eslint”

Not possible yet 😕 (GitHub Platform Forum — Stack Overflow)

With v3 and REST (incomplete results):

curl 'https://api.github.com/search/code?q=org%3Aw3c+filename%3Apackage.json+in%3Afile+eslint'

https://github.com/search?q=org%3Aw3c+filename%3Apackage.json+in%3Afile+eslint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.