How do I query the GitHub API v4 for the contents of a certain directory of a repository at a certain tag?
This is the best I've come up with so far:
query {
repository(owner:"example", name:"example") {
refs(refPrefix: "tags") {
}
}
}
From this post, you can get the GitObject
with object
to filter on branch:/path/folder
and print the Tree
. The following will get the tree from gson
folder from tag gson-2.4
and print name
, type
and mode
:
query {
repository(owner:"google", name:"gson") {
object(expression: "gson-2.4:gson") {
... on Tree{
entries{
name
type
mode
}
}
}
}
}
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