1

我已在此处阅读有关如何删除版本的说明:https ://help.github.com/en/github/managing-packages-with-github-packages/deleting-a-package

当我尝试使用 curl 时,它只是给了我这个错误:

{
  "message": "Problems parsing JSON",
  "documentation_url": "https://developer.github.com/v4"
}

这是我的卷曲:

curl -X POST -H "Accept: application/vnd.github.package-deletes-preview+json" -H "Authorization: bearer PERSONALACCESSTOKEN" -d '{"query":"mutation { deletePackageVersion(input:{packageVersionId:\"1.0.0\"}) { success }}"}' https://api.github.com/graphql

我错过了什么吗?我怎样才能正确地验证自己?

4

1 回答 1

2

您在此处传递了1.0.0for的值packageVersionId

'{"query":"mutation { deletePackageVersion(input:{packageVersionId:\"1.0.0\"}) { success }}"}'

packageVersionId是包层的id。

您可以使用以下命令查询 GitHub 包:

$ curl -sL -X POST https://api.github.com/graphql \
-H "Authorization: bearer <github_token>" \
-d '{"query":"query{repository(owner:\"<repo_owner>\",name:\"<repo_name>\"){registryPackages(first:10){nodes{packageType,registryPackageType,name,nameWithOwner,id,versions(first:10){nodes{id,version,readme}}}}}}"}' | jq .

(确保更新<github_token><repo_owner><repo_name>

例如,对于上述命令packageVersionId的以下返回输出的MDE0OlBhY2thZ2VWZXJzaW9uMzc5MTE0kFcA版本:0.1a

***
  "registryPackages": {
    "nodes": [
      {
        "packageType": "DOCKER",
        "registryPackageType": "docker",
        "name": "demo_image",
        "nameWithOwner": "aki***/demo_image",
        "id": "MDc6UGFja2FnZTYzNjg3AkFc",
        "versions": {
          "nodes": [
            {
              "id": "MDE0OlBhY2thZ2VWZXJzaW9uMzc5MTE0kFcA",
              "version": "0.1a",
              "readme": null
            },
***
于 2020-01-06T09:57:43.353 回答