如何从命令行列出Github软件包注册表存储库中的所有软件包? [英] How can i list all packages in a Github Package Registry repository from the command line?

查看:48
本文介绍了如何从命令行列出Github软件包注册表存储库中的所有软件包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我们拥有Github软件包注册表存储库 https://maven.pkg.github.com/someOrganization .我如何才能将此仓库中所有软件包的列表显示为txt文件?

Let's say that we have the Github package registry repository https://maven.pkg.github.com/someOrganization . How can I cat the list of all packages in this repo into a txt file ?

推荐答案

可以使用

This can be done using Preview API for GitHub Packages. You can query it in GraphQL using:

query($login: String!) {
  organization(login:$login) {
    registryPackages(first:10, packageType:MAVEN) {
      nodes {
       name             
      }
    }
  }
}

这将输出如下内容:

{
  "data": {
    "organization": {
      "registryPackages": {
        "nodes": [
          {
            "name": "package1"
          },
          {
            "name": "package2"
          }            
        ]
      }
    }
  }
}

在撰写本文时,这两个条件都需要:

At the time of writing this requires both:

  • 具有 org:read packages:read
  • 的有效令牌预览API的
  • Accept 标头: application/vnd.github.packages-preview + json
  • Valid Token with org:read and packages:read
  • Accept header for preview API: application/vnd.github.packages-preview+json

现在,因为您想通过命令行执行此操作,因此可以 curl 对其进行编码.如何使用 curl 访问GitHub的GraphQL API已经有了一个很好的答案: https://stackoverflow.com/a/42021388/1174076

Now because you want to do this over the command line, you could curling it. There's already a good answer on how to use curl to access GitHub's GraphQL API: https://stackoverflow.com/a/42021388/1174076

希望这会有所帮助.

这篇关于如何从命令行列出Github软件包注册表存储库中的所有软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆