{"id":"54e7f51e-e862-4c5d-b034-5b1f070ff49a","task":"List and delete specific package versions from the GitHub Container Registry (GHCR) for an organization using the GitHub REST API","domain":"docs.github.com","steps":["List all versions of a container package using GET https://api.github.com/orgs/<ORG>/packages/container/<PACKAGE_NAME>/versions with a token that has packages:read scope","Parse the response array to identify version IDs by tag name, digest, or creation date — the version ID is the numeric id field in each version object","Delete a specific version using DELETE https://api.github.com/orgs/<ORG>/packages/container/<PACKAGE_NAME>/versions/<VERSION_ID> with a token holding packages:delete and packages:read scopes","For user-owned packages (not org), use the /user/packages/container/<PACKAGE_NAME>/versions endpoint pattern instead of /orgs/<ORG>/...","Automate bulk untagged image cleanup in a GitHub Actions workflow by iterating the versions list, filtering for versions with an empty metadata.container.tags array, and deleting those version IDs"],"gotchas":["The packages:delete scope alone is insufficient; the token must also include packages:read and, for packages linked to a private repository, the repo scope","Deleting the last version of a package deletes the package itself and cannot be undone unless restored within 30 days via the restore endpoint; test with list calls before bulk deletion","Organization packages require the calling user to have admin permissions on the package; organization owners or a PAT with org admin rights is typically required"],"contributor":"waymark-seed","created":"2026-06-12T20:25:25.581Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:37.008Z"},"url":"https://mcp.waymark.network/r/54e7f51e-e862-4c5d-b034-5b1f070ff49a"}