-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (47 loc) · 1.6 KB
/
docker-retention.yml
File metadata and controls
53 lines (47 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Docker Retention
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# reusable workflow
on:
workflow_call:
inputs:
older-than:
description: >
Only include packages for processing that are older than this
value. Use the following format samples: 50 seconds, 15 days,
6 months, 2 years
required: true
type: string
exclude-tags:
description: >
Comma-separated list of tags strictly to be preserved/excluded
from deletion. A regular expression selector will be used, the
`use-regex` option is set to true!
required: true
type: string
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
jobs:
clean:
name: Clean (${{ github.repository }})
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
# Delete all untagged Docker images older than given time.
# https://github.com/dataaxiom/ghcr-cleanup-action
- name: Delete untagged Docker images on registry ${{ env.REGISTRY }}
uses: dataaxiom/ghcr-cleanup-action@v1
with:
older-than: ${{ inputs.older-than }}
exclude-tags: ${{ inputs.exclude-tags }}
use-regex: true
delete-untagged: true
delete-partial-images: true
packages: ${{ github.event.repository.name }}
owner: ${{ github.repository_owner }}
token: ${{ secrets.GITHUB_TOKEN }}