Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
play

GitHub Action

Delete ghcr.io package tag

v1.0.0

Delete ghcr.io package tag

play

Delete ghcr.io package tag

Delete a tagged package from ghcr.io

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Delete ghcr.io package tag

uses: chipkent/action-cleanup-package@v1.0.0

Learn more about this action in chipkent/action-cleanup-package

Choose a version

action-cleanup-package

This is a GitHub Action to delete GitHub packages. It is very useful to clean up unneeded Docker images in the GitHub Container Registry (ghcr.io) after a PR is closed.

# Delete Docker images after PR merge
#

name: 'Clean up Docker images from PR'

on:
  pull_request:
    types: [closed]

jobs:
  purge-image:
    name: Delete image from ghcr.io
    runs-on: ubuntu-latest
    steps:
      - uses: chipkent/action-cleanup-package@v1.0.0
        with:
          package-name: ${{ github.event.repository.name }}
          tag: pr-${{ github.event.pull_request.number }}
          github-token: ${{ secrets.CI_ACTION_TOKEN }}