Skip to content

Commit

Permalink
Update clean-containers
Browse files Browse the repository at this point in the history
  • Loading branch information
vedran-kasalica committed Sep 2, 2024
1 parent ba992c5 commit f40a7b0
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/clean-containers.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: "Clean the old docker images"

on:
workflow_dispatch: # This line adds the manual trigger
workflow_dispatch: # Manual trigger
schedule:
- cron: "21 21 * * *"
- cron: "21 21 * * *" # Scheduled run

jobs:
clean-ghcr:
Expand All @@ -13,19 +13,19 @@ jobs:
packages: write
env:
REGISTRY: ghcr.io

steps:
- name: downcase REPO name
run: |
echo "REPO=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
- name: Set REPO environment variable
run: echo "REPO=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV

- name: Delete 'PR' containers older than a week
uses: snok/container-retention-policy@v3.0.0
with:
account: user
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
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

0 comments on commit f40a7b0

Please sign in to comment.