Action for delete containers from Github container registry
delete all / untagged ghcr containers in a repository
- name: Delete untagged ghcr
uses: Chizkiyahu/delete-untagged-ghcr-action@v6
with:
# Personal access token (PAT) used to fetch the repository. The PAT is configured
# with the local git config, which enables your scripts to run authenticated git
# commands. The post-job step removes the PAT.
# needs delete:packages permissions
# required: true
# [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)
token: ${{ secrets.PAT_TOKEN }}
# Repository name or name with owner
# Delete only from repository name
# Default: ${{ github.repository }}
repository: ''
# 'The repository owner name'
# Default: ${{ github.repository_owner }}
repository_owner: ''
# 'The package names'
# Delete only from comma separated package names
# required: false
package_name: ''
# Delete only package versions without tag
# required: false
# Default: true
# choices: true, false
untagged_only: true
# Exclude untagged multiplatform packages from deletion
# Manifests are usually such packages so they should be excluded
# only for untagged_only=true
# Default: true
# needs docker installed
except_untagged_multiplatform: true
# Include signatures corresponding to deleted packages
# without tags. Signature has the `sha256-<digest>.sig` tag where
# respective untagged package has `sha256:<digest>` name
# required: false
# default: false
with_sigs: true
# The owner type
# required: true
# choices: org, user
owner_type: ''
- Delete all owner containers without tags
- Delete all owner containers
- Delete all containers from repository without tags
- Delete all containers from repository
- Delete all containers from package without tags
- Delete all containers from package with signatures
- Delete all containers from package
- name: Delete all owner containers without tags
uses: Chizkiyahu/delete-untagged-ghcr-action@v6
with:
token: ${{ secrets.PAT_TOKEN }}
repository_owner: ${{ github.repository_owner }}
owner_type: org # or user
- name: Delete all owner containers
uses: Chizkiyahu/delete-untagged-ghcr-action@v6
with:
token: ${{ secrets.PAT_TOKEN }}
repository_owner: ${{ github.repository_owner }}
untagged_only: false
owner_type: org # or user
- name: Delete all containers from repository without tags
uses: Chizkiyahu/delete-untagged-ghcr-action@v6
with:
token: ${{ secrets.PAT_TOKEN }}
repository_owner: ${{ github.repository_owner }}
repository: ${{ github.repository }}
untagged_only: true
owner_type: org # or user
- name: Delete all containers from repository without tags
uses: Chizkiyahu/delete-untagged-ghcr-action@v6
with:
token: ${{ secrets.PAT_TOKEN }}
repository_owner: ${{ github.repository_owner }}
repository: ${{ github.repository }}
untagged_only: true
owner_type: org # or user
except_untagged_multiplatform: true
- name: Delete all containers from repository
uses: Chizkiyahu/delete-untagged-ghcr-action@v6
with:
token: ${{ secrets.PAT_TOKEN }}
repository_owner: ${{ github.repository_owner }}
repository: ${{ github.repository }}
untagged_only: false
owner_type: org # or user
- name: Delete all containers from package without tags
uses: Chizkiyahu/delete-untagged-ghcr-action@v6
with:
token: ${{ github.token }}
repository_owner: ${{ github.repository_owner }}
repository: ${{ github.repository }}
package_name: the-package-name
untagged_only: true
owner_type: org # or user
- name: Delete all containers from package without tags
uses: Chizkiyahu/delete-untagged-ghcr-action@v6
with:
token: ${{ github.token }}
repository_owner: ${{ github.repository_owner }}
repository: ${{ github.repository }}
package_name: the-package-name
untagged_only: true
owner_type: org # or user
except_untagged_multiplatform: true
Important
This option has been tested with v3.7.0 cosign-installer
action
using cosign-release
v2.4.1. See workflow
for example ("Install cosign" and "Sign the published Docker image" steps).
- name: Delete all containers from package without tags
uses: Chizkiyahu/delete-untagged-ghcr-action@v6
with:
token: ${{ github.token }}
repository_owner: ${{ github.repository_owner }}
repository: ${{ github.repository }}
package_name: the-package-name
untagged_only: true
with_sigs: true
owner_type: org # or user
- name: Delete all containers from package
uses: Chizkiyahu/delete-untagged-ghcr-action@v6
with:
token: ${{ github.token }}
repository_owner: ${{ github.repository_owner }}
repository: ${{ github.repository }}
package_name: the-package-name, other-package-name
untagged_only: false
owner_type: org # or user