Giter VIP home page Giter VIP logo

remove-dockertag-action's Introduction

Remove Docker Tag Action

This GitHub action removes a Docker tag from the GitHub Container Registry package repository. It is a workaround for the current lack of API implementation of this feature in GHCR.

Deleting tags is described in the Docker Registry specification: https://github.com/opencontainers/distribution-spec/blob/main/spec.md#deleting-tags.

Discussion link: https://github.com/orgs/community/discussions/26267.

How it works

Action creates and pushes a dummy Docker image to the registry with a given tag so that the tag is separated from other images, and then deletes the dummy image.

Usage

- uses: rafalkk/remove-dockertag-action@v1
  with:
    # Name of the Docker tag to delete.
    # (required)
    tag_name: ''

    # Token is required to log in to the Container Registry and use the GitHub API.
    # (required)
   github_token: ''

    # Set this to `true` if you are using it within an organization.
    # Organization accounts have different API endpoints.
    # (optional)
    # default: false
   is_organization: ''
   

Private Repository Input (optional, for private repositories only)

Action can be stored in a private repository, if so, you will need to provide the following entry.

    # Token with access to the private repository where the Action is stored.
    # (optional)
   private_repo_token: ''

Example in workflow

Removes the "main" tag from the repository from which the run was made.

name: Remove Docker Tag

on:
    workflow_dispatch:

jobs:
  remove-docker-tag:
    runs-on: ubuntu-latest

    # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
    # (required)
    permissions:
      contents: read
      packages: write

    steps:
    - name: Remove Docker Tag
      uses: rafalkk/remove-dockertag-action@v1
      with:
        tag_name: main
        github_token: ${{ secrets.GITHUB_TOKEN }}

Private repository usage

name: Remove Docker Tag

on:
    workflow_dispatch:

jobs:
  remove-docker-tag:
    runs-on: ubuntu-latest

    # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
    # (required)
    permissions:
      contents: read
      packages: write

    steps:
    - name: Remove Docker Tag
      uses: my-private-tools-repo/remove-dockertag-action@v1
      with:
        tag_name: main
        github_token: ${{ secrets.GITHUB_TOKEN }}
        private_repo_token: ${{ secrets.my_private_tools_repo_token }}

remove-dockertag-action's People

Contributors

rafalkk avatar

Stargazers

 avatar  avatar

Watchers

 avatar

remove-dockertag-action's Issues

Issue with GitHub Container Registry (GHCR) URL Case Sensitivity

Hi there,

I recently attempted to implement your workflow, which I find quite promising. However, I encountered an issue due to the case sensitivity of GitHub usernames in GHCR URLs. My GitHub username is capitalized, but unfortunately, GHCR only supports lowercase URLs.

Is there a possibility for this to be resolved in the near future?

Here are the details of the encountered problem. If you need more information, I'm more than willing to provide additional logs. You can also find the exact workflow run at the following link: Workflow Run

Error Message:

Error: buildx failed with: ERROR: invalid tag "ghcr.io/ThijmenGThN/swaparr:edge": repository name must be lowercase

Workflow yaml:

name: Publish to GitHub Container Registry

on:
  push:
    branches: [edge]

jobs:
  recycle:
    runs-on: ubuntu-latest

    permissions:
      contents: read
      packages: write

    steps:
    - name: Recycle Edge Image
      uses: rafalkk/remove-dockertag-action@v1
      with:
        tag_name: edge
        github_token: ${{ secrets.GH_PAT }}

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.