github - 在一次调用中从 Github Graphql API 获取有关多个存储库的信息

标签 github graphql github-graphql

我正在尝试创建一个 Github GraphQL API 查询,该 API 接收存储库列表作为参数,并在单个 API 调用中返回这些存储库的信息,有人知道该怎么做吗?

像这样(我知道这行不通)

query myOrgRepos($repos: [String!]!) {
  search(query:"""
  repo in $repos
  """, type: REPOSITORY, first: 100) {
      repo: nodes {
          ... on Repository{
              name
              description
              updatedAt
          }
      }
  }

最佳答案

我花了一些时间来理解您的评论,所以我会发布完整的答案。关键是在查询字符串中使用 Github 的高级搜索“语法”,参见 here例如。

以下查询将找到用户“github”的所有存储库以及用户“graphql”的 graphql-js 存储库:

query {
  search(query: "user:github repo:graphql/graphql-js" type: REPOSITORY first: 10) {
    nodes {
      ... on Repository {
        name
        description
        updatedAt
      }
    }
  }
}

关于github - 在一次调用中从 Github Graphql API 获取有关多个存储库的信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59393869/

相关文章:

git - 更新 Github 上 fork 存储库的多个分支

express - GraphQL + 中继 : How can I perform authorization for refetching?

graphql - 我真的需要用于graphql的prisma ORM吗?

github - 如何从 Github Graphql API 获取 Readme.MD?

api - GitHub GraphQL API v4 与 REST API v3

git - 为什么 GitHub "pull request review"中的批准按钮被禁用?

github - 我可以从私有(private) github 存储库公开发布吗?

reactjs - React Apollo GraphQL : Expecting a parsed GraphQL document. 也许您需要将查询字符串包装在 "gql"标签中?

git - 如何使用 Git Bash 推送到 GitHub?