-
Notifications
You must be signed in to change notification settings - Fork 2
49 lines (49 loc) · 2.03 KB
/
reusable-clean-containers.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
name: Reusable container image cleanup
on:
workflow_call:
inputs:
package-name:
type: string
required: true
description: |
name of package/container to remove
starts with repository name e.g. base-images/centos
ignored-regex:
type: string
required: true
description: |
regex which is applied against image tags to ignore/keep those versions
number-kept:
type: number
required: true
default: 3
description: |
number of untagged versions to keep in package history
jobs:
clean:
runs-on: ubuntu-latest
steps:
- if: ${{ startsWith(github.repository, 'GeoNet/') == false }}
name: require GeoNet org
run: |
exit 1
- uses: actions/delete-package-versions@e5bc658cc4c965c472efe991f8beea3981499c55 #v5.0.0
with:
# Can be a single package version id, or a comma separated list of package version ids.
# Defaults to an empty string.
ignore-versions: ${{ inputs.ignored-regex }}
# Owner of the package.
# Defaults to the owner of the repo executing the workflow.
# Required if deleting a version from a package hosted in a different org than the one executing the workflow.
owner: geonet
# Name of the package.
# Required
package-name: ${{ inputs.package-name }}
# Type of the package. Can be one of container, maven, npm, nuget, or rubygems.
# Required
package-type: container
# The number of latest versions to keep.
# This cannot be specified with `num-old-versions-to-delete`. By default, `min-versions-to-keep` takes precedence over `num-old-versions-to-delete`.
# When set to 0, all deletable versions will be deleted.
# When set greater than 0, all deletable package versions except the specified number will be deleted.
min-versions-to-keep: ${{ inputs.number-kept }}