我如何从命令行列出 Github Package Registry 存储库中的所有软件包?
How can i list all packages in a Github Package Registry repository from the command line?
假设我们有 Github 包注册表存储库 https://maven.pkg.github.com/someOrganization。我怎样才能把这个 repo 中所有包的列表放到一个 txt 文件中?
这可以使用 Preview API for GitHub Packages 来完成。您可以在 GraphQL 中查询它:
query($login: String!) {
organization(login:$login) {
registryPackages(first:10, packageType:MAVEN) {
nodes {
name
}
}
}
}
这将输出如下内容:
{
"data": {
"organization": {
"registryPackages": {
"nodes": [
{
"name": "package1"
},
{
"name": "package2"
}
]
}
}
}
}
在撰写本文时,这需要:
org:read
和 packages:read
的有效令牌
Accept
header 预览 API: application/vnd.github.packages-preview+json
现在因为您想通过命令行执行此操作,所以您可以 curl
ing 它。关于如何使用 curl
访问 GitHub 的 GraphQL API 已经有一个很好的答案:https://whosebug.com/a/42021388/1174076
希望对您有所帮助。
假设我们有 Github 包注册表存储库 https://maven.pkg.github.com/someOrganization。我怎样才能把这个 repo 中所有包的列表放到一个 txt 文件中?
这可以使用 Preview API for GitHub Packages 来完成。您可以在 GraphQL 中查询它:
query($login: String!) {
organization(login:$login) {
registryPackages(first:10, packageType:MAVEN) {
nodes {
name
}
}
}
}
这将输出如下内容:
{
"data": {
"organization": {
"registryPackages": {
"nodes": [
{
"name": "package1"
},
{
"name": "package2"
}
]
}
}
}
}
在撰写本文时,这需要:
org:read
和packages:read
的有效令牌
Accept
header 预览 API:application/vnd.github.packages-preview+json
现在因为您想通过命令行执行此操作,所以您可以 curl
ing 它。关于如何使用 curl
访问 GitHub 的 GraphQL API 已经有一个很好的答案:https://whosebug.com/a/42021388/1174076
希望对您有所帮助。