Skip to content

Commit

Permalink
Merge pull request #20 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 e139105 + 996c605 commit 98eddcb
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/clean-containers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 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:*
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

0 comments on commit 98eddcb

Please sign in to comment.