问题:如何从Github软件包注册表中使软件包“消失”?
- Documentation说:删除所有版本后,您无法“删除”,但程序包“消失”。
背景:
- Gradle发布任务中的错字导致发布了不应发布的软件包。
到目前为止的步骤:
- 我在Github Web应用程序上找不到“删除”选项。
- 我试图通过Github的GraphQL API删除,但是我需要此命令的程序包ID:
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
- 我在Github Web应用程序上找不到完整的packageVersionId。
- 我尝试向API查询包ID,但未能形成有效的查询:
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"
}
- 我尝试使用GraphQL API Explorer,但我自动设置的令牌缺少足够的权限:
# 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,"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'],'user'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens."
}
]
}
- 我没有在Explorer Web App上找到设置另一个访问令牌的选项。
所需的解决方案
- 我想知道是否有更简单的方法来执行此操作,否则,如何获取取消链接包以使其消失所需的packageVersionIds。
更新1::关于发布到公共存储库的软件包。