forked from quartx-analytics/ghcr-cleaner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
80 lines (76 loc) · 2.59 KB
/
action.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: 'GHCR Cleaner'
author: 'William Forde'
description: 'Delete containers on github container registry without tags'
branding:
icon: 'trash-2'
color: 'blue'
inputs:
token:
description: >
Personal access token (PAT) used to fetch the repository. The PAT is configured
with the local git config, which enables your scripts to run authenticated git
commands. The post-job step removes the PAT.
needs delete:packages permissions
required: true
repository-owner:
description: "The repository owner name."
default: ${{ github.repository_owner }}
required: false
repository-name:
description: "Delete only from repository name."
default: ""
required: false
package-name:
description: "Delete only from package name."
required: false
default: ""
owner-type:
description : "Owner type (org or user)."
required: true
options:
- org
- user
delete-untagged:
description: "Delete package versions that have no tags and are not a dependency of other tags."
required: false
default: true
keep-at-most:
description: "Keep at most the given amount of image versions. Only applies to tagged image versions."
required: false
default: 0
filter-tags:
description: "List of tags to filter for when using --keep-at-most. Accepts tags as Unix shell-style wildcards."
required: false
default: ""
skip-tags:
description: "List of tags to ignore when using --keep-at-most. Accepts tags as Unix shell-style wildcards."
required: false
default: ""
dry-run:
description: "Run the script without making any changes."
required: false
default: false
runs:
using: "composite"
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: pip install -r ${{ github.action_path }}/requirements.txt
shell: bash
- name: Run registry cleaner
shell: bash
run: |
args="--token ${{ inputs.token }} "
args+="--dry-run ${{ inputs.dry-run }} "
args+="--repo-owner ${{ inputs.repository-owner }} "
args+="--repo-name ${{ inputs.repository-name }} "
args+="--package-name ${{ inputs.package-name }} "
args+="--owner-type ${{ inputs.owner-type }} "
args+="--delete-untagged ${{ inputs.delete-untagged }} "
args+="--keep-at-most ${{ inputs.keep-at-most }} "
args+="--filter-tags ${{ inputs.filter-tags }} "
args+="--skip-tags ${{ inputs.skip-tags }} "
echo "args: $args"
python ${{ github.action_path }}/action.py $args