energy-quants / mambaforge

Base container with the 'mambaforge' Python distribution installed
MIT License
3 stars 2 forks source link

Add action to cleanup old images #8

Closed dhirschfeld closed 2 years ago

dhirschfeld commented 2 years ago

https://docs.github.com/en/rest/reference/packages#delete-a-package-for-an-organization

dhirschfeld commented 2 years ago

Calling the rest api via gh seems to trip up on the extra slashes, even when percent encoded:

❯ gh api -X DELETE -H "Accept: application/vnd.github.v3+json" 'orgs/energy-quants/packages/container/mambaforge%2Fmambaforge%2Fpr-2'
{
  "message": "Invalid request.\n\nFor 'links/2/schema', {} is not a null.",
  "documentation_url": "https://docs.github.com/rest/reference/packages#delete-a-package-for-an-organization"
}
gh: Invalid request.

For 'links/2/schema', {} is not a null. (HTTP 422)
dhirschfeld commented 2 years ago

Maybe use https://github.com/octokit/request-action

dhirschfeld commented 2 years ago

PR packages automatically deleted in https://github.com/energy-quants/mambaforge/pull/9

Still require to cleanup untagged images from the main package

dhirschfeld commented 2 years ago

Untagged images implemented (#11) https://github.com/energy-quants/mambaforge/blob/09b1dbab3b446c69245cecd99fd217815af0cec8/.github/workflows/cleanup-images.yml