github - 在 graphql 查询中区分私有(private)/内部 github 存储库

标签 github graphql github-api

我正在尝试从我们的组织中获取所有私有(private)存储库。在下面的 graphql 查询中,它返回内部和私有(private)存储库。

对于隐私,只能对PRIVATEPUBLIC 进行过滤。 似乎只有一个名为 isPrivate 的字段,据我所知,没有像 isInternal 这样的字段。

query organizationRepositories($owner: String!) {
    organization(login:$owner) {
        repositories(first: 100, privacy: PRIVATE) {
            totalCount
            nodes {
                owner {
                login
            }
            name
            id
            url
            isPrivate
        }
      }
    }
}

使用上述查询的所有结果都显示isPrivate: true,我知道其中一些是内部的,一些是私有(private)的。

有没有办法区分私有(private)存储库和内部存储库?通过基于某些字段组合(指示私有(private)与内部)循环结果,或者通过以不同的方式查询。

最佳答案

您可以使用搜索查询:

query {
  search(query: "org:<my-org> is:internal", type: REPOSITORY, first: 100) {
    repositoryCount
    nodes {
      ... on Repository {
        name
      }
    }
  }
}

有关详细信息,请参阅 https://docs.github.com/en/github/searching-for-information-on-github/searching-for-repositories#search-by-repository-visibility

关于github - 在 graphql 查询中区分私有(private)/内部 github 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62933888/

相关文章:

linux - 如何直接从 git bash 创建一个 github 存储库?

python - Github-API : How do I plot the number of commits to a repo?

github - 开源项目中的/dist目录是什么意思?

node.js - 如何在 GraphQl 中使用 graphql-type-json 包

java - 拦截器在 Spring Boot GraphQL 中不起作用

git - 使用 REST 克隆 github 存储库

php - Laravel:如何模拟依赖注入(inject)类方法

eclipse - 配置 Eclipse/EGit 以跟踪上游存储库

node.js - API 网关和微服务通信

GitHub Actions 从 API 获取以创建拉取请求