List the id and names of the branches in the repository owned by someone else

I would like to list the id and names of the branches in the repository named “foo” owned by “johndoe” in https://docs.github.com/en/graphql/overview/explorer.

I am using https://docs.github.com/en/graphql/overview/explorer to make the query.

Any suggestion?

>Solution :

You can run this query on https://docs.github.com/en/graphql/overview/explorer

edit: This will bring the first 10 of the branches! first or last is required to make the query.

{
  user(login:"johndoe"){
    repository(name:"foo") {
      refs(first: 10, refPrefix: "refs/heads/"){
        nodes {
          id,
          name}
      }
    }
  }
}

Leave a Reply