Skip to content

Image Clean Up

Image Clean Up #1135

name: Image Clean Up
on:
schedule:
- cron: '15 7 * * *'
workflow_dispatch:
jobs:
clean-ghcr:
name: Delete old unused container images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9'
- run: npm ci
- shell: bash
run: echo "ALL_APPS=$(npx nx show projects --type=app | tr "\n" ", ")" >> $GITHUB_ENV
- name: Delete ADSP containers older than a week
uses: snok/container-retention-policy@v2
with:
image-names: ${{ env.ALL_APPS }}
cut-off: 1 week ago UTC
account-type: org
org-name: GovAlta
keep-at-least: 3
token: ${{ secrets.CLEAN_UP_ACCESS_TOKEN }}