使用 Github API 在 GitHub 上查询组织内的存储库

Query repos within organization on GitHub using Github API

我需要 assemble 脚本,它将获取存储库的名称,从 "test*" 开始,在特定组织内,在 Github。

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

您可以使用 search query 通过位于存储库名称、描述或自述文件中的关键字 test 来过滤存储库(但仅存储库名称没有过滤器):

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
        }
      }
    }
  }
}

Try it in the explorer

汇总以上我发现的所有答案,要在组织内查找所有具有某些搜索条件的回购(包括私有),我需要使用以下查询:

https://api.github.com/search/repositories?q=org:MY_ORG:MY_SEARCHCRITERIA&page=1&per_page=100&access_token=MY_ACCESSTOKEN