GraphQL API 受保护的分支

GraphQL API Protected branch

我正在使用 GITHUB API V3 in one of my projects now we are migrating to GraraphQL API V4. I want to list all the branches of the repo and I want to check whether it is a protected branch. In GITHUB API V3 it has a branches API,它将列出所有分支及其受保护的密钥,因此很容易检查。现在在 GraphQL 中,我可以获取所有分支列表,但我无法检查分支是否受保护。

   refs(first: 100, refPrefix: "refs/heads/") {
        nodes {
            name
        }
    }

有人可以就如何进行提供帮助吗?

如果 refs 无法实现,那么有没有办法单独列出所有受保护的分支

我找到了获取受保护分支的逻辑

{
    viewer {
        repository(owner: "parithiban", name: "git-slack-bot") {
            branchProtectionRules(first: 5) {
                nodes {
                    pattern
                    requiredApprovingReviewCount
                    matchingRefs(first: 100) {
                        nodes {
                            name
                        }
                    }
                }
            }
        }
    }
}