Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bots-house/ghcr-delete-image-action
♻️ Delete GitHub Container Registry image by tag
https://github.com/bots-house/ghcr-delete-image-action
github-actions github-container-registry
Last synced: about 1 month ago
JSON representation
♻️ Delete GitHub Container Registry image by tag
- Host: GitHub
- URL: https://github.com/bots-house/ghcr-delete-image-action
- Owner: bots-house
- License: mit
- Created: 2021-05-19T08:52:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-18T17:32:03.000Z (2 months ago)
- Last Synced: 2024-12-17T02:35:28.497Z (about 1 month ago)
- Topics: github-actions, github-container-registry
- Language: JavaScript
- Homepage:
- Size: 666 KB
- Stars: 41
- Watchers: 4
- Forks: 19
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ghcr-delete-image
[![CI](https://github.com/bots-house/ghcr-delete-image-action/actions/workflows/ci.yml/badge.svg)](https://github.com/bots-house/ghcr-delete-image-action/actions/workflows/ci.yml)
[![wakatime](https://wakatime.com/badge/github/bots-house/ghcr-delete-image-action.svg)](https://wakatime.com/badge/github/bots-house/ghcr-delete-image-action)Delete image from [Github Container Registry](https://github.com/features/packages) by tag.
Useful for cleanup of pull request scoped images.## Usage
## Delete image when PR was closed.
```yaml
name: Cleanup PR Imageson:
pull_request:
types: [closed]jobs:
purge-image:
name: Delete image from ghcr.io
runs-on: ubuntu-latest
steps:
- name: Delete image
uses: bots-house/[email protected]
with:
# NOTE: at now only orgs is supported
owner: bots-house
name: some-web-service
# NOTE: using Personal Access Token
token: ${{ secrets.PAT }}
tag: pr-${{github.event.pull_request.number}}
```## Keep latest N untagged images
```yaml
name: Cleanup Untagged Imageson:
# every sunday at 00:00
schedule:
- cron: "0 0 * * SUN"
# or manually
workflow_dispatch:jobs:
delete-untagged-images:
name: Delete Untagged Images
runs-on: ubuntu-latest
steps:
- uses: bots-house/[email protected]
with:
# NOTE: at now only orgs is supported
owner: bots-house
name: some-web-service
# NOTE: using Personal Access Token
token: ${{ secrets.PAT }}
# Keep latest N untagged images
untagged-keep-latest: 3
```