Question: How can I make a package "disappear" from Github Package Registry?
- Documentation says: You cannot "delete" but a package "disappears" when all versions are removed.
Background:
- A typo in the Gradle publish task resulted in the release of packages which should not be published.
Steps so far:
- I did not find a "delete" option on the Github Web App.
- I tried to delete via the GraphQL API of Github but I need a package ID for this command:
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
- I did not find the full packageVersionId on the Github Web App.
- I tried to query the API for the Package IDs but failed to form a valid query:
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"
}
- I tried to use the GraphQL API Explorer but I the automatically set up token misses the sufficient rights:
# See query above - the API returns via the Explorer:
{
"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."
}
]
}
- I did not find an option on the Explorer Web App to set another access token.
Desired Solution
- I like to know if there is a simpler way to do this and if not, how to get the packageVersionIds required to un-link the packages so that they disappear.
Update1: It's about packages published to a public repository.