Github Container Registry Cleaner #120
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: Github Container Registry Cleaner | |
on: | |
schedule: | |
- cron: "0 4 * * *" | |
pull_request: | |
types: | |
- closed | |
push: | |
branches: | |
- main | |
jobs: | |
delete_old_images: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: "Delete untagged images" | |
if: github.event_name == 'schedule' | |
uses: dataaxiom/ghcr-cleanup-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Clean up development images" | |
if: github.event_name == 'pull_request' && (github.event.action == 'closed' || github.event.pull_request.merged == true) | |
uses: dataaxiom/ghcr-cleanup-action@v1 | |
with: | |
tags: "pr-${{github.event.pull_request.number}}" | |
token: ${{ secrets.GITHUB_TOKEN }} |