本文介绍了Github Package Registry如何删除版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have read the instructions on how to delete a version here: https://help.github.com/en/github/managing-packages-with-github-packages/deleting-a-package

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

When I tried to use the curl, it just gives me this error:

{
  "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

我错过了什么吗?我该如何正确验证自己的身份?

Am I missing something? How can I properly authenticate myself?

推荐答案

您要在此处传递packageVersionId1.0.0值:

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

packageVersionId是包装层的ID.

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

You can query the GitHub packages with a command as follows:

$ 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>)

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

For example packageVersionId becomes MDE0OlBhY2thZ2VWZXJzaW9uMzc5MTE0kFcA for the version of 0.1a on a following returned output of above command:

***
  "registryPackages": {
    "nodes": [
      {
        "packageType": "DOCKER",
        "registryPackageType": "docker",
        "name": "demo_image",
        "nameWithOwner": "aki***/demo_image",
        "id": "MDc6UGFja2FnZTYzNjg3AkFc",
        "versions": {
          "nodes": [
            {
              "id": "MDE0OlBhY2thZ2VWZXJzaW9uMzc5MTE0kFcA",
              "version": "0.1a",
              "readme": null
            },
***

这篇关于Github Package Registry如何删除版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 18:59