Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GraphQL to efficiently request details of multiple repositories (enhancement) #414

Open
jamestelfer opened this issue Nov 1, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@jamestelfer
Copy link
Contributor

Proposed enhancement to use the GH GraphQL API to retrieve repository details in batches, instead of one by one via REST. This would be useful for the list supplied to --repo, as well as the code search functionality introduced in #399.

Coming from a suggestion in #399:

Nice to have (no need if you don't want to) would be to use the v4 (GraphQL) API to fetch all of these with one request.
That is true for --repo as well, but maybe even more here since I guess it will normally be more returns.

On further investigation, I was uncertain whether the GraphQL API would supply all the required information:

I'm not sure that there's a direct equivalent of the permissions element returned by REST. There's a similar field (viewerPermission), but it has some caveats.

The users permission level on the repository. Will return null if authenticated as an GitHub App.

@jamestelfer jamestelfer added the bug Something isn't working label Nov 1, 2023
@jamestelfer
Copy link
Contributor Author

Prototyping query

{
  repository(owner: "lindell", name: "multi-gitter") {
    name
    nameWithOwner
    owner {
      login
    }
    defaultBranchRef {
      name
    }
    createdAt
    isArchived
    isDisabled
    isFork
    sshUrl
    url
    viewerPermission
    repositoryTopics(last: 50) {
      nodes {
        topic {
          name
        }
      }
    }
  }
}

@lindell lindell added enhancement New feature or request and removed bug Something isn't working labels Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants