Skip to content

Cleanup Untagged Packages #9

Cleanup Untagged Packages

Cleanup Untagged Packages #9

name: Cleanup Untagged Packages
on:
schedule:
# Run every Sunday at 02:00 UTC
- cron: '0 2 * * 0'
workflow_dispatch:
env:
REGISTRY: ghcr.io
jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Debug package information
run: |
echo "Repository: ${{ github.repository }}"
echo "Repository owner: ${{ github.repository_owner }}"
echo "Repository name: ${{ github.event.repository.name }}"
- name: Delete untagged main container images
id: cleanup-main
continue-on-error: true
uses: actions/delete-package-versions@v5
with:
package-name: ${{ github.event.repository.name }}
package-type: container
min-versions-to-keep: 5
delete-only-untagged-versions: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Delete untagged ohpc-lint images
id: cleanup-lint
continue-on-error: true
uses: actions/delete-package-versions@v5
with:
package-name: ohpc-lint
package-type: container
min-versions-to-keep: 3
delete-only-untagged-versions: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Report cleanup results
run: |
echo "Cleanup Results:"
echo "Main container cleanup: ${{ steps.cleanup-main.outcome }}"
echo "Lint container cleanup: ${{ steps.cleanup-lint.outcome }}"
if [[ "${{ steps.cleanup-main.outcome }}" == "failure" ]]; then
echo "⚠️ Main container cleanup failed - package may not exist yet"
fi
if [[ "${{ steps.cleanup-lint.outcome }}" == "failure" ]]; then
echo "⚠️ Lint container cleanup failed - package may not exist yet"
fi
echo "✅ Cleanup workflow completed"