-
Notifications
You must be signed in to change notification settings - Fork 17
/
action.yml
66 lines (65 loc) · 2.36 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
name: 'Delete untagged ghcr'
author: 'Chuzkiyahu Raful'
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: true
repository:
description: 'Delete only from repository name'
default: ${{ github.repository }}
required: false
package_name:
description: 'Delete only from comma separated package names'
required: false
untagged_only:
description: 'Delete only package versions without tag'
default: true
except_untagged_multiplatform:
description: 'Exclude untagged multiplatform packages from deletion (only for --untagged_only)'
default: true
owner_type:
description : "Owner type (org or user)"
required: true
outputs:
num_deleted:
description: 'Number of package versions that were deleted during the run.'
value: ${{ steps.delete-untagged-ghcr-action.outputs.num_deleted }}
runs:
using: "composite"
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install Python dependencies
shell: bash
run: pip install -r ${{ github.action_path }}/requirements.txt
- name: Run action
id: delete-untagged-ghcr-action
shell: bash
run: |
args=( "--token" "${{ inputs.token }}" )
args+=( "--repository_owner" "${{ inputs.repository_owner }}" )
if [[ -n "${{ inputs.repository }}" ]]; then
args+=( "--repository" "${{ inputs.repository }}" )
fi
if [[ -n "${{ inputs.package_name }}" ]]; then
args+=( "--package_names" "${{ inputs.package_name }}" )
fi
args+=( "--untagged_only" "${{ inputs.untagged_only }}" )
args+=( "--except_untagged_multiplatform" "${{ inputs.except_untagged_multiplatform }}" )
args+=( "--owner_type" "${{ inputs.owner_type }}" )
echo "args: ${args[@]}"
python ${{ github.action_path }}/clean_ghcr.py "${args[@]}"