Skip to content

Delete old ghrc images #608

Delete old ghrc images

Delete old ghrc images #608

Workflow file for this run

name: Delete old ghrc images
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0' # every sunday at midnight
permissions:
id-token: write
jobs:
clean-ghcr:
name: Delete old unused container images
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- name: Checkout internal 🛎️
id: checkout-internal
uses: actions/checkout@v3
with:
repository: 'equinor/energyvision-internal'
ref: main
token: ${{ secrets.PADMS_PAT }}
- name: Get tags to keep from latest-prod-tags.json
id: get-tags
run: |
TAGS=$(jq -r '[.web + .studio | unique[]] | join(", ")' latest-prod-tags.json)
echo "TAGS_TO_KEEP=$TAGS" >> $GITHUB_ENV
echo "TAGS TO KEEP: $TAGS"
- name: Clean up Docker images
id: delete-containers
uses: snok/container-retention-policy@v2
with:
token: ${{ secrets.PADMS_PAT }}
account-type: org
org-name: Equinor
image-names: energyvision/*
cut-off: a week ago UTC
keep-at-least: 5
skip-tags: ${{ env.TAGS_TO_KEEP }}, *-latest
# dry-run: true
- name: log-errors-to-slack 📄
uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()