Git Product home page Git Product logo

delete-untagged-ghcr-action's Introduction

delete-untagged-ghcr-action V2

test Codacy Badge

Action for delete containers from Github container registry

delete all / untagged ghcr containers in a repository

Usage

- name: Delete untagged ghcr
  uses: Chizkiyahu/delete-untagged-ghcr-action@v3
  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
    # 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: ''

Scenarios

Delete all owner containers without tags

- name: Delete all owner containers without tags
  uses: Chizkiyahu/delete-untagged-ghcr-action@v3
  with:
      token: ${{ secrets.PAT_TOKEN }}
      repository_owner: ${{ github.repository_owner }}
      owner_type: org # or user

Delete all owner containers

  - name: Delete all owner containers
    uses: Chizkiyahu/delete-untagged-ghcr-action@v3
    with:
        token: ${{ secrets.PAT_TOKEN }}
        repository_owner: ${{ github.repository_owner }}
        untagged_only: false
        owner_type: org # or user

Delete all containers from repository without tags

  - name: Delete all containers from repository without tags
    uses: Chizkiyahu/delete-untagged-ghcr-action@v3
    with:
        token: ${{ secrets.PAT_TOKEN }}
        repository_owner: ${{ github.repository_owner }}
        repository: ${{ github.repository }}
        untagged_only: true
        owner_type: org # or user

Delete all containers from repository without tags except untagged multiplatform packages

- 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@v3
  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

Delete all containers from repository

- name: Delete all containers from repository
  uses: Chizkiyahu/delete-untagged-ghcr-action@v3
  with:
      token: ${{ secrets.PAT_TOKEN }}
      repository_owner: ${{ github.repository_owner }}
      repository: ${{ github.repository }}
      untagged_only: false
      owner_type: org # or user

Delete all containers from package without tags

- name: Delete all containers from package without tags
  uses: Chizkiyahu/delete-untagged-ghcr-action@v3
  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

Delete all containers from package without tags except untagged multiplatform packages

- 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.repository_owner }}
    password: ${{ github.token }}
- name: Delete all containers from package without tags
  uses: Chizkiyahu/delete-untagged-ghcr-action@v3
  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

Delete all containers from packages

- name: Delete all containers from package
  uses: Chizkiyahu/delete-untagged-ghcr-action@v3
  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

delete-untagged-ghcr-action's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.