This repository has been archived by the owner on May 14, 2024. It is now read-only.
Clean #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Clean" | |
on: | |
workflow_dispatch: | |
jobs: | |
# Deletes old container images | |
ghcr-cleaner: | |
name: Registry Cleaner | |
runs-on: 'ubuntu-latest' | |
steps: | |
# As per documentation, the authentication to the GHCR registry must be done using a personal access token (PAT) to delete packages. | |
# Only classic tokens can be used, fined-grained ones and GITHUB_TOKEN are currently (2024-01) not supported. | |
# More: | |
# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry | |
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token | |
# The recommendation is to create a new PAT with only the `read:packages` and `delete:packages` scopes. | |
# Create new token: | |
# https://github.com/settings/tokens/new?scopes=read:packages,delete:packages | |
# List personal access tokens: | |
# https://github.com/settings/tokens | |
# | |
# https://github.com/marketplace/actions/ghcr-cleaner | |
# Forked from: https://github.com/Chizkiyahu/delete-untagged-ghcr-action | |
- name: GHCR 🚮 | |
uses: quartx-analytics/ghcr-cleaner@v1 | |
with: | |
token: ${{ secrets.PAT_TOKEN }} | |
repository-owner: ${{ github.repository_owner }} | |
repository-name: ${{ github.repository }} | |
owner-type: user | |
delete-untagged: true |