Skip to content

Purge test container images #156

Purge test container images

Purge test container images #156

name: Purge test container images
permissions:
id-token: write
contents: read
packages: write
on:
# Enable manual trigger
workflow_dispatch:
schedule:
# Run twice a day
- cron: "30 0,12 * * *"
env:
ACTION_LINK: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
jobs:
purge_ghcr_dev:
name: Delete old unused test container images
runs-on: ubuntu-latest
if: github.repository == 'radius-project/radius'
steps:
- name: Delete 'dev' containers older than a week
uses: snok/[email protected]
with:
account: radius-project
token: ${{ secrets.GH_RAD_CI_BOT_PAT }}
image-names: dev/*
image-tags: "pr-*"
cut-off: 1w
create_issue_on_failure:
name: Create issue for failing purge old images resources run
needs: [purge_ghcr_dev]
runs-on: ubuntu-latest
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_RAD_CI_BOT_PAT }}
script: |
github.rest.issues.create({
...context.repo,
title: `Purge old images failed - Run ID: ${context.runId}`,
labels: ['bug', 'test-failure'],
body: `## Bug information \n\nThis bug is generated automatically if the purge old images workflow fails. For further investigation, please visit [here](${process.env.ACTION_LINK}).`
})