How do I get the license of a repository


#1

After looking for a while, playing around in the GraphQL explorer, I couldn’t manage to find a way of retrieving the license info for repositories.

Through the previous REST api, one simple way was to do

https://api.github.com/repos/AUTHOR/REPO/license

How do I access that value through GraphQL ?


Add your schema requests
#2

@Xerios We don’t expose licenses through the GraphQL API yet, but I’ve added this to our internal list of schema requests. I’m gonna go ahead and lock this thread since we have another one just for schema requests. You’ll see a follow-up in this thread! Thanks! Add your schema requests


#3

#4

Hey @Xerios!

I know it’s 256 days later, but I wanted to announce that we’ve made the license info for a Repository available! Here’s an example query:

{
  repository(owner: "golang", name: "go") {
    licenseInfo {
      name
      conditions {
        description
        key
        label
      }
      description
    }
  }
}

Returns

{
  "data": {
    "repository": {
      "licenseInfo": {
        "name": "BSD 3-clause \"New\" or \"Revised\" License",
        "conditions": [
          {
            "description": "A copy of the license and copyright notice must be included with the software.",
            "key": "include-copyright",
            "label": "License and copyright notice"
          }
        ],
        "description": "A permissive license similar to the <a href=\"/licenses/bsd-2-clause/\">BSD 2-Clause License</a>, but with a 3rd clause that prohibits others from using the name of the project or its contributors to promote derived products without written consent."
      }
    }
  }
}

#5