首页 > 解决方案 > 使用 Github API 在 GitHub 上查询组织内的存储库

问题描述

我需要在 Github 上的特定组织内组装脚本,该脚本将从“test*”开始获取存储库的名称。

任何人都可以提示我 - 以哪种方式挖掘?这可以通过一些 API 查询实现,还是我可以通过 git 命令行来实现?

标签: gitgithubgithub-api

解决方案


您可以使用搜索查询按位于 repo 名称、描述或 README 中的关键字过滤存储库test(但没有仅用于 repo 名称的过滤器):

Github API v3 休息

https://api.github.com/search/repositories?q=org%3Agithub%20test&per_page=100

Github API v4 GraphQL

{
  search(query: "test org:github", type: REPOSITORY, first: 100) {
    repositoryCount
    edges {
      node {
        ... on Repository {
          nameWithOwner
        }
      }
    }
  }
}

在资源管理器中尝试


推荐阅读