-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
CI images build up over time.
These can be deleted after a certain time has elapsed, provided they don't exceed ghcr.io image deletion policy i.e have not been used too much which should be almost universally the case.
actions/delete-package-versions#101 prevents non-integers to be passed, so tags are not deleted. It seems v3.0.1 is not affected.
Since we have to list packages and filter by date, and the action does not support it, we might make use of this workaround:
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORGNAME/packages/PACKAGE_TYPE/PACKAGE_NAME/versions
URL should be: https://api.github.com/ogs/DataDog/packages/container/PACKAGE_NAME/versions
This should return:
[
{
// ...
},
{
"id": 12345678, // extract this to pass to action
"name": "some-tag", // select on this
// ...
},
// ...
]
Selectable via:
jq -r '.[] | select(.name == "some-tag").id'
Note: the query might be paginated.
Metadata
Metadata
Assignees
Labels
No labels