Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 2

[GraphQL] List of repositories by name

Hi everyone! In my company we have a few teams with their repositories, and we created a bot that notifies about PRs and such.

The thing is: we are now retrieving every repo and then filter them. Is there a way to only get repos by name?

 

Something like: repositories(name: ["repo1", "repo2", "repo3"]. I know that this specifically can't be done, but is there a way to accomplish this?

 

Thanks!

1 Reply
Highlighted
Copilot Lvl 2
Message 2 of 2

Re: [GraphQL] List of repositories by name

The closest I can come up with if the number of repositories is relatively small:

query { 
  repo1: repository(name: "name1", owner: "shedar") {
    ...RepoFragment
  }
  repo2: repository(name: "name2", owner: "shedar") {
  	...RepoFragment
  }
}

fragment RepoFragment on Repository {
  name
  id
}

To not bother with escaping values, you can create an input variable for each repo name. But you still have a dynamic query creation.