Reputation: 73
I am trying to check if a branch already exists in repo for that first I need to get all the open branches present.
query searhbranches {
repositoryOwner(login: "username"){
repository(name: "config-replica"){
name
[branches] // something like this but its not available
}
}
}
Upvotes: 5
Views: 2789
Reputation: 2718
You want to look at the refs
node inside repository
. Here's an example query that works for me:
{
repository(owner: "desktop", name: "desktop") {
refs(first: 50, refPrefix:"refs/heads/") {
nodes {
name
}
}
}
}
This is what it returns:
{
"data": {
"repository": {
"refs": {
"nodes": [
{
"name": "add-lfs-path-lookup"
},
{
"name": "add-notes-lookup-to-parser"
},
{
"name": "ahead-behind-toggle-spike"
},
{
"name": "all-stash-functions"
},
...
]
}
}
}
}
...
Upvotes: 6