Skip to content

🗑️ Clean Package #8

🗑️ Clean Package

🗑️ Clean Package #8

Workflow file for this run

# Attention:
# - Need goto [Settings -> Secrets -> Actions]
# - Add a [PAT] secrets as GitHub Personal access token
name: "🗑️ Clean Package"
# Controls when the workflow will run
on:
schedule:
- cron: "0 0 1 * *" # the first day of the month
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
clean-up:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Initialize workflow variables
id: vars
run: |
echo "APP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT
- name: Delete old images
uses: snok/container-retention-policy@v2
with:
image-names: ${{steps.vars.outputs.APP_NAME}}
cut-off: A week ago UTC
keep-at-least: 10
skip-tags: latest
account-type: personal
token: ${{ secrets.PAT }}