Reputation: 104
I am trying to fetch all my repositories that contain topic "portfolio" using Github GraphQL API.
For now, I found only how to fetch all repos on github with a specific topic, like so :
{
search(type: REPOSITORY, query: "topic: portfolio", last: 50) {
repos: edges {
repo: node {
... on Repository {
url
}
}
}
}
}
And I know how to fetch all repos for a specific user, like so:
{
user(login: "VitFL") {
repositories(last: 50) {
repos: nodes {
url
}
}
}
}
But I have no idea how to combine those queries, so I could receive all repos with topic "portfolio" for a specific user.
Does anyone know how to achieve this result?
Upvotes: 3
Views: 1684
Reputation: 302
Using search()
, a user
argument can be added to the query
value.
Also, the whitespace after the colon should be removed, i.e. topic: portfolio
-> topic:portfolio
. You will notice far more results with this change.
{
search(type: REPOSITORY, query: "user:VitFL topic:portfolio", last: 50) {
repos: edges {
repo: node {
... on Repository {
url
}
}
}
}
}
Upvotes: 1