I'm using GitHub's GraphQL API to retrieve the directories and files within a repository, but I only need some specific subsets.
The repository I'm working with has a structure like:
- / #root
- /.gitignore
- /.github/...
- /categoryOne
- /categoryOne/itemOne
- /categoryOne/itemOne/config.ini
- /categoryTwo
- /categoryTwo/itemOne
- /categoryTwo/itemOne/config.ini
- /categoryTwo/itemOne/maybe_some_junk/...
...
I'm trying to efficiently query the (category)->(item)->(config) nodes, and have been able to do that, but so far haven't found a way to omit the "junk" items (like the .gitignore file and .github tree).
Here's my crude-but-working query.
query Repository {
repository(name: "my-repository", owner: "example") {
object(expression: "HEAD:") {
... on Tree {
categories: entries {
mode
name
type
object {
... on Tree {
items: entries {
name
type
configFile: object {
... on Blob {
text
}
}
}
}
}
}
}
}
}
}
That runs fine, but includes quite a few results I'd like to filter out. I've tried adding (where: {...}) clauses to various lines, and all have indicated that isn't syntactically correct.
Does Github's GraphQL API support filtering out some of the Blobs/Trees when querying the Repository Objects? If so, what operation/syntax is needed?