繁体   English   中英

在 Github 的 GraphQL API 如何获取没有特定repositoryTopic的repository?

[英]In Github's GraphQL API how to get repositories that do not have a particular repositoryTopic?

With Github's GraphQL API I recently found " Github API: Getting topics of a Github repository " that mentions you can get a count of topics:

{
  repository(owner: "twbs", name: "bootstrap") {
    repositoryTopics(first: 10) {
      edges {
        node {
          topic {
            name
          }
        }
      }
    }
  }
}

但是在文档和搜索中,我没有找到如何查询不包含主题template的存储库,例如:

query ($github_org: String!, $repo_count: Int!) {
  organization(login: $github_org) {
    repositories(first: $repo_count, privacy: PUBLIC, isFork: false) {
      nodes {
        id
        name
        openGraphImageUrl
        createdAt
        stargazerCount
        url
        description
        repositoryTopics(first: 10, after: "template") {
          edges {
            node {
              id
            }
          }
        }
      }
    }
  }
}

after使用的正确实现是什么? 在 Github 的 GraphQL API 中如何排除包含某个主题的存储库?

我的理解是,对于组织查询,您无法进行那种存储库过滤。

相反,您可以将搜索查询与以下内容一起使用:

query ($repo_count: Int!) {
  search (first: $repo_count,
          type: REPOSITORY,
          query: "org:my-organization topic:my-topic") {
    nodes {
      ... on Repository {
        name
      }
    }
  }
}

上述查询搜索给定组织内具有给定主题的所有存储库。

但是您正在寻找没有主题的存储库,理论上根据文档您应该能够使用-topic:my-topic来做到这一点。 不幸的是,对主题的否定不起作用,似乎有一个错误 :-(

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM