Schema Request: Create repository and get repository contents

schema-request

#1

Currently, repository creation (https://developer.github.com/v3/repos/#create) and content retrieval (https://developer.github.com/v3/repos/contents/#get-contents) are only supported in the v3 API. Additionally, adding topics to a repository is only supported in the v4 API (https://developer.github.com/v4/reference/mutation/accepttopicsuggestion/) and must be done one at a time.

Creating an application that creates a repository with a given set of topics would therefore require using both API versions and making multiple calls. Ideally, topics could be specified in the createRepository mutation (once it exists) and we could fetch repository contents with GraphQL. In fact, repository contents seem like a great example of (potentially) deeply nested data that GraphQL is well suited for.

I assume these things are on the roadmap, but could you provide a rough estimate of when they can be expected to ship?


#2

Hi there @bclinkinbeard ! Thanks for sharing your thoughts about this with us. I can see where you’re coming from and how it would be helpful to have repository creation mutation and fetching a repository’s contents implemented in our GraphQL API.

We don’t currently provide a rough estimate of when specific features will ship. However, I recommend following our GitHub Platform Roadmap and our blog for the latest changes:

I hope that helps, but let me know if you have any other questions about this!


#3

The granularity doesn’t really help answer @bclinkinbeard’s question, tbh. :wink:

Overall, it would be nice to have a finer-grained roadmap of the GraphQL API. Doesn’t necessarily need a timeline, just the kinds of API under consideration. At least, clarification as to whether you’re planning to bring parity between the APIs and whether you’re planning to deprecate the REST API at some point of have both co-exist.


#4

I’m able to set multiple topics using the following query:

mutation ($input: UpdateTopicsInput!, $limit: Int!) {
  updateTopics(input: $input) {
    repository {
      repositoryTopics(first: $limit) {
        totalCount
        edges {
          node {
            topic {
              name
            }
          }
        }
      }
    }
  }
}

The query variables I used were:

{
  "limit": 2,
  "input": {
    "repositoryId": "$REPO_RELAY_ID",
    "topicNames": ["$TOPIC_1", "$TOPIC_2"]
  }
}

#5

Thanks @kytrinyx, that is definitely helpful.


#6

@bclinkinbeard I don’t know if you still need this, but we released a couple of endpoints in the REST API to read and replace repository topics: https://developer.github.com/changes/2017-07-17-update-topics-on-repositories/


#7

Thanks @kytrinyx!


#8

If I read this correctly there is currently no way to create a repository using the v4 API? Oops! Looks like I’m too early an adopter!


#9

That is correct! We have a recorded schema request for this, we’ll update this issue when those mutations are available!


#10

Okay well for those who want to see how create a repo with the v3 API using perl, here’s an example:


#11

Hi,

Looking forward to have at least most of the API v3 features ported to graphql, right now is a little bit messy to code automations, because there are unfortunately (still always) dependencies on the REST API, and I end up using both API v3 and the graphql API v4 which is a pity.

I would love to see that missing delete repo mutations ported to Github Enterprise too.

Cheers