Skip to content

GraphQL API Protected branch #24640

Oct 12, 2019 · 20 comments · 2 replies
Discussion options

You must be logged in to vote

You can use the following query to get the list of branch protection rules (and what branches they match) and the list of all branches for a repository:

{
  repository(owner: "atom", name: "atom") {
    branchProtectionRules(first: 100) {
      nodes {
        pattern
        matchingRefs(first: 100) {
          nodes {
            name
          }
        }
      }
    }
    refs(first: 100, refPrefix: "refs/heads/") {
      nodes {
        name
      }
    }
  }
}

I hope that helps! Let us know if you have more questions.

Replies: 20 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@grossmane
Comment options

@grossmane
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants