-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (44 loc) · 1.44 KB
/
ghcr-maintenance.yml
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
name: Cleanup ghcr.io
on:
pull_request:
types: [closed]
# every sunday at 00:00
schedule:
- cron: "0 0 * * SUN"
# or manually
workflow_dispatch:
jobs:
purge-image:
name: Delete images from ghcr.io
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Delete PR Image
uses: bots-house/ghcr-delete-image-action@v1.1.0
if: github.event_name == 'pull_request'
with:
owner: bendoerr-terraform-modules
name: terraform-aws-fargate-on-demand-custodian
token: ${{ github.token }}
tag: pr-${{github.event.pull_request.number}}
- name: Delete Untagged Images
uses: bots-house/ghcr-delete-image-action@v1.1.0
if: github.event_name != 'pull_request'
with:
owner: bendoerr-terraform-modules
name: terraform-aws-fargate-on-demand-custodian
token: ${{ github.token }}
untagged-keep-latest: 1
- name: Delete old sha-ref Images
#uses: snok/container-retention-policy@v2
uses: injabie3-moe/container-retention-policy@use-github-token
if: github.event_name == 'workflow_dispatch'
with:
account-type: org
org-name: bendoerr-terraform-modules
image-names: terraform-aws-fargate-on-demand-custodian
token: ${{ github.token }}
token-type: github-token
filter-tags: sha-*
cut-off: 1 minute ago UTC