Skip to content

Commit

Permalink
Merge pull request #5 from CSCfi/feature/clean-unused-containers
Browse files Browse the repository at this point in the history
Delete old unused container images
  • Loading branch information
blankdots authored Jul 24, 2023
2 parents 50d66fc + 7e96c35 commit b4e275f
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/clean-containers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: ghcr actions

on:
schedule:
- cron: "21 21 * * *"

jobs:
clean-ghcr:
name: Delete old unused container images
runs-on: ubuntu-latest
permissions:
packages: write
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:*
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

0 comments on commit b4e275f

Please sign in to comment.