"is_template" key on repo not showing up when it is supposed to

I need a way to tell from the GitHub API whether or not a repo is a template. It seems like the “is_template” key at the GET /repos/:owner/:repo link would be the perfect solution to this. However, there is a bug in which this key does not show up at all.

I accessed one of my template repos from the GET /repos/:owner/:repo link. The object that I got back strangely did not include the “is_template” key. I confirmed that there was no “is_template” key whether or not I was logged in to GitHub and whether or not the template repo I was trying to access was created from another template repo or not.

I’ve made both of my template repos that I was working with public so you should be able to see that there isn’t an “is_template” key on either of them: https://api.github.com/repos/t-hadcal/Test and https://api.github.com/repos/t-hadcal/Test2.

1 Like

Hi @t-hadcal :wave:

Would using the GitHub v4 / GraphQL API be an option for you? The isTemplate field appears to work when using this. You can find the API explorer here: https://developer.github.com/v4/explorer/.

To confirm, I created a repository called template an executed the following query:

query { 
  viewer { 
    repository(name: "template")
    {
      nameWithOwner
      isTemplate
    }
  }
}

Here’s a .NET library you can use to access it:

I hope that helps!