Clean the old docker images #309
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 the old docker images" | |
on: | |
workflow_dispatch: # This line adds the manual trigger | |
schedule: | |
- cron: "21 21 * * *" | |
jobs: | |
clean-ghcr: | |
name: Delete old unused container images | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
env: | |
REGISTRY: ghcr.io | |
steps: | |
- name: downcase REPO name | |
run: | | |
echo "REPO=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV | |
- name: Delete 'PR' containers older than a week | |
uses: snok/[email protected] | |
with: | |
image-names: ${{ env.REGISTRY }}/${{ env.REPO }} | |
filter-tags: "sha-*,sha256:*" | |
skip-tags: latest | |
cut-off: "A week ago UTC" | |
account-type: org | |
org-name: ${{ github.repository_owner }} | |
keep-at-least: 1 | |
token: ${{ secrets.GH_REPO_TOKEN }} | |
timestamp-to-use: updated_at |