Skip to content

Instantly share code, notes, and snippets.

@tripu
Last active October 20, 2018 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripu/518207445ae0db22ed5553c253cfb3f6 to your computer and use it in GitHub Desktop.
Save tripu/518207445ae0db22ed5553c253cfb3f6 to your computer and use it in GitHub Desktop.
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