简体   繁体   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: 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
          }
        }
      }
    }
  }
}

but in the docs and in my search I'm not finding how I can query repositories that do not contain the topic template , example:但是在文档和搜索中,我没有找到如何查询不包含主题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
            }
          }
        }
      }
    }
  }
}

is the correct implementation to use after ? after使用的正确实现是什么? In Github's GraphQL API how to exclude a repository if it contains a certain topic?在 Github 的 GraphQL API 中如何排除包含某个主题的存储库?

My understanding is that with the organization query you cannot do that kind of repository filtering.我的理解是,对于组织查询,您无法进行那种存储库过滤。

Instead, you can use the search query with something like this:相反,您可以将搜索查询与以下内容一起使用:

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

The above query searches for all repositories within a given organization that have a given topic.上述查询搜索给定组织内具有给定主题的所有存储库。

But you were looking for the repositories without a topic, in theory according to the documentation you should be able to do that with -topic:my-topic .但是您正在寻找没有主题的存储库,理论上根据文档您应该能够使用-topic:my-topic来做到这一点。 Unfortunately the negation on topic doesn't work, there seems to be a bug .不幸的是,对主题的否定不起作用,似乎有一个错误 :-( :-(

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

相关问题 GitHub的GraphQL API:如何获得对特定公共回购所做的所有提交? - GitHub's GraphQL API: How can I get all of the commits I've contributed to a particular public repo? Github GraphQL API:如何收集特定用户的存储库? - Github GraphQL API: How can I gather specific user's repositories? 如何通过 GraphQL API 搜索下载 Github 存储库? - How to download Github repositories via GraphQL API search? 如何使用 GitHub GraphQL API 获取具有特定主题的所有存储库? - How to fetch all repositories with specific topic, using GitHub GraphQL API? 如何搜索具有特定文件名的文件的 Github 存储库? - How to search Github repositories which have file with particular filename? 有没有办法使用Github的API获取每种语言的存储库数量? - Is there a way to get the number of repositories per language using Github's API? 一次调用即可从 Github Graphql API 获取有关多个存储库的信息 - Get info about several repositories from Github Graphql API in a single call 如何为用户的固定存储库向 GitHub 发出 API 调用? - How do I make an API call to GitHub for a user's pinned repositories? GitHub API:获取固定存储库 - GitHub API: Get Pinned Repositories GitHub API v4 Graphql:获取当前授权用户组织及其存储库 - GitHub API v4 Graphql: Get current authorized user organizations and their repositories
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM