Reputation: 2024
I'm trying to get repositories of user with login name "somelogin".
It returns all repositories but I'm trying to get repositories owned by him only. Because new API uses GraphQL I couldn't did it.
Currently I'm using:
{
"query": "query { user(login:\"furknyavuz\") {repositories(first: 50) { nodes { name url }}}}"
}
Upvotes: 10
Views: 2814
Reputation: 5172
It's super easy to build graph QL using the Github GraphQL explorer. Please refer to the attached screenshot. https://docs.github.com/en/graphql/overview/explorer
{ user(login: "leerob") { name email company bio followers { totalCount } following { totalCount } repositories(first: 50, isFork: false) { nodes { name url stargazerCount primaryLanguage { id name } } } } }
Upvotes: 1
Reputation: 45473
You can use isFork: false
to exclude fork. In the explorer :
{
user(login: "furknyavuz") {
repositories(first: 50, isFork: false) {
nodes {
name
url
}
}
}
}
With curl :
curl -H "Authorization: bearer token" -d '
{
"query": "query { user(login: \"furknyavuz\") { repositories(first: 50, isFork: false) { nodes { name url } } } }"
}
' https://api.github.com/graphql
Upvotes: 6