Skip to content

Delete image tag from Github Container Registry #26267

Answered by airtower-luna
pluma asked this question in Packages
Discussion options

You must be logged in to vote

The API for that was added very recently:

The GitHub Blog

Packages: delete and restore for all packages - GitHub Changelog

Packages: delete and restore for all packages

I’ve tried the API with a script to clean up old untagged versions, maybe you can get some inspiration from there:

github.com

airtower-luna/hello-ghcr/blob/e17ebc574711f4bcf85f8bd6b2380e226901778d/ghcr-prune.py

#!/usr/bin/python3
# PYTHON_ARGCOMPLETE_OK
import argparse
import dateutil.parser
import getpass
import os
import requests
from datetime import datetime, timedelta

author = "Fiona Klute"
version = "0.1"
copyright = "Copyright (C) 2021 Fiona Klute"
license = "MIT"

GitHub API documentation: https://docs.github.co…

Replies: 10 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@matifali
Comment options

@rafalkk
Comment options

Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@felfert
Comment options

@neilime
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Packages Host your dependencies, libraries, and production-ready code, right from your repository Product Feedback
10 participants