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@v2
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 name'
# Delete only from package name
# required: false
package_name: ''
# Delete only package versions without tag
# required: false
# Default: true
# choices: true, false
untagged_only: true
# Except untagged multiplatform packages from deletion
# only for untagged_only=true
# needs docker installed
except_untagged_multiplatform: false
# 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
- name: Delete all owner containers without tags
uses: Chizkiyahu/delete-untagged-ghcr-action@v2
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@v2
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@v2
with:
token: ${{ secrets.PAT_TOKEN }}
repository_owner: ${{ github.repository_owner }}
repository: ${{ github.repository }}
untagged_only: true
owner_type: org # or user
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry with PAT_TOKEN
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PAT_TOKEN }}
- name: Delete all containers from repository without tags
uses: Chizkiyahu/delete-untagged-ghcr-action@v2
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@v2
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@v2
with:
token: ${{ secrets.PAT_TOKEN }}
repository_owner: ${{ github.repository_owner }}
repository: ${{ github.repository }}
package_name: the-package-name
untagged_only: true
owner_type: org # or user
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry with PAT_TOKEN
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PAT_TOKEN }}
- name: Delete all containers from package without tags
uses: Chizkiyahu/delete-untagged-ghcr-action@v2
with:
token: ${{ secrets.PAT_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
- name: Delete all containers from package
uses: Chizkiyahu/delete-untagged-ghcr-action@v2
with:
token: ${{ secrets.PAT_TOKEN }}
repository_owner: ${{ github.repository_owner }}
repository: ${{ github.repository }}
package_name: the-package-name
untagged_only: false
owner_type: org # or user