Skip to content

Container Image Cleanup #37

Container Image Cleanup

Container Image Cleanup #37

# SPDX-FileCopyrightText: Copyright (c) 2025 Cisco and/or its affiliates.
# SPDX-License-Identifier: Apache-2.0
name: Container Image Cleanup
on:
workflow_dispatch:
inputs:
image-tags:
required: false
type: string
description: Which images to remove. Supports GLOB pattern.
default: "!latest !v*.*.*"
dry-run:
required: false
type: boolean
description: Prints output showing images which would be deleted but does not actually delete any images.
default: true
env:
repo: agntcy
images: oasf-server
permissions:
packages: write
jobs:
dispatch:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
name: Cleanup stale container images
steps:
- name: Remove stale images
uses: snok/container-retention-policy@4f22ef80902ad409ed55a99dc5133cc1250a0d03 # v3.0.0
with:
# Who should delete images
account: ${{ env.repo }}
token: ${{ secrets.GITHUB_TOKEN }}
# How to delete images
dry-run: ${{ inputs.dry-run }}
cut-off: 1s
timestamp-to-use: created_at
# Which images should be deleted
image-names: ${{ env.images }}
image-tags: ${{ env.image-tags }}