I am trying to query GitHub for information about repositories using their v4 graphql. One of the things I want to query is the breakdown of all the languages used in the repo. Or if possible, the breakdown of the languages across all of a user's repos. I have tried the following snippet, but it returns null, where as primary language returns the primary language
languages: {
edges: {
node: {
name
}
}
}
The only thing I can find relating to languages is the primary language. But I would like to show stats for a user and the all languages they use either in a single repo or across off their repos.
You are missing the slicing field, here you can put first: 100
to get the first 100 languages for the repository:
{
user(login: "torvalds") {
repositories(first: 100) {
nodes {
primaryLanguage {
name
}
languages(first: 100) {
nodes {
name
}
}
}
}
}
}
If you want to have stats per language (eg if you want to know which is the second, third language etc...) I'm affraid this is not currently possible with the graphql API but using the List Languages API Rest for instance https://api.github.com/repos/torvalds/linux/languages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With