Reputation: 16524
I have the following query:
{
repository(owner: "org", name: "name") {
name
object(expression: "master:package.json") {
... on Blob {
text
}
}
}
}
but as you can see I have to hardcode master
in the object expression. I'm wondering if there's a way to instead use the default branch in that query. Is that possible without having to do 2 queries (1 to get the default branch, then another to get the file content)?
Upvotes: 5
Views: 1178
Reputation: 1323953
There was a related question (with bounty too) on that, detailed in this thread... but it is the syntax you are using:
The argument passed to expression on the
object
field is actually a git revision expression suitable forgit rev-parse
, so I guess you can have fun with it to do advanced querying.
So any way to specify a revision should do, including HEAD, which would reference the default remote branch. But not the "current branch" though.
Upvotes: 3