Clean the old docker images #311
Workflow file for this run
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: | |
push: | |
branches: | |
- main | |
workflow_dispatch: # Manual trigger | |
schedule: | |
- cron: "21 21 * * *" # Scheduled run | |
jobs: | |
clean-ghcr: | |
name: Delete old unused container images | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
env: | |
REGISTRY: ghcr.io | |
steps: | |
- name: Set REPO environment variable | |
run: echo "REPO=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV | |
- name: Delete 'PR' containers older than a week | |
uses: snok/[email protected] | |
with: | |
account: user | |
image-names: ${{ env.REGISTRY }}/${{ env.REPO }} | |
token: ${{ secrets.GH_REPO_TOKEN }} | |
image-tags: "pr*" # target any image that has a tag starting with the word test or dev | |
# image-tags: "!latest" | |
cut-off: 2w 3d | |
dry-run: true | |