Help
cancel
Showing results for 
Search instead for 
Did you mean: 
hb0
Copilot Lvl 2
Message 1 of 1

Delete or "hide" a (public) package

I'm testing the "new" Github Packages feature, currently with Gradle.

 

I succeeded to publish a package but want to delete this test version again.

The documentation says deletion is not possible but I delete all linked versions.

 

I did not find an option in the web UI of Github so I tried the API:

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

 

However, for this to work I need the ID of the package version.

I also did not find this in the web UI of Github so I tried the API again, but am failing:

curl -X POST \
-H "Accept: application/vnd.github.package-deletes-preview+json" \
-H "Authorization: bearer ACCESS_TOKEN" \
-d "query {
  organization(login: "ORGANIZATION_ACCOUNT") {
    registryPackages {
      edges {
        node {
          name
          id
        }
      }
    }
  }
}" \
https://api.github.com/graphql

The API returns:

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

 

When I try this via the GraphQL API Explorer:

query {
    organization(login:"ORGANIZATION_ACCOUNT") {
    registryPackages(first: 100) {
      edges {
        node {
          name
          id
        }
      }
    }
  }
}

I receive:

{
  "errors": [
    {
      "type": "INSUFFICIENT_SCOPES",
      "locations": [
        {
          "line": 6,
          "column": 11
        }
      ],
      "message": "Your token has not been granted the required scopes to execute this query. The 'name' field requires one of the following scopes: ['read:packages'], but your token has only been granted the: ['read:gpg_key', 'read:org', 'read:public_key', 'read:repo_hook', 'repo', 'user'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens."
    },
    {
      "type": "INSUFFICIENT_SCOPES",
      "locations": [
        {
          "line": 7,
          "column": 11
        }
      ],
      "message": "Your token has not been granted the required scopes to execute this query. The 'id' field requires one of the following scopes: ['read:packages'], but your token has only been granted the: ['read:gpg_key', 'read:org', 'read:public_key', 'read:repo_hook', 'repo', 'user'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens."
    }
  ]
}

 

If this is really the "easiest way" to accomplish my task - how can I provide a token to the GraphQL Explorer to be able to fix my query format error which the API reports unspecificly?