-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathaction.yml
81 lines (81 loc) · 2.57 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
81
name: "cls3-action"
author: "k.goto"
description: "Run cls3 in GitHub Actions"
branding:
icon: "command"
color: "blue"
inputs:
bucket-name:
description: "Names of one or multiple buckets you want to delete (comma separated)"
required: false
force:
description: "ForceMode (Delete the bucket together)"
default: false
required: false
quiet:
description: "Hide live display of number of deletions (default: true in GitHub Actions ONLY.)"
default: true
required: false
old-versions-only:
description: "Delete old version objects only (including all delete-markers)"
default: false
required: false
directory-buckets-mode:
description: "Clear Directory Buckets for S3 Express One Zone"
default: false
required: false
table-buckets-mode:
description: "Clear Table Buckets for S3 Tables"
default: false
required: false
region:
description: "AWS Region"
default: "us-east-1"
required: false
runs:
using: "composite"
steps:
- shell: bash
run: |
set -eu
if [ ! -e /usr/local/bin/cls3 ]; then
DOWNLOAD_URL=$(curl https://api.github.com/repos/go-to-k/cls3/releases/latest | jq -r '.assets[].browser_download_url|select(match("Linux_x86_64."))')
cd /tmp
curl -sfLO ${DOWNLOAD_URL}
FILENAME=$(basename $DOWNLOAD_URL)
tar xzvf ${FILENAME}
chmod +x cls3
sudo mv cls3 /usr/local/bin/
rm ${FILENAME}
fi
if [ -n "${{ inputs.bucket-name }}" ]; then
buckets=""
for bucket in $(echo ${{ inputs.bucket-name }} | tr ',' ' '); do
buckets="${buckets}-b ${bucket} "
done
force=""
if [ "${{ inputs.force }}" = "true" ]; then
force="-f"
fi
quiet=""
if [ "${{ inputs.quiet }}" = "true" ]; then
quiet="-q"
fi
old_versions_only=""
if [ "${{ inputs.old-versions-only }}" = "true" ]; then
old_versions_only="-o"
fi
directory_buckets_mode=""
if [ "${{ inputs.directory-buckets-mode }}" = "true" ]; then
directory_buckets_mode="-d"
fi
table_buckets_mode=""
if [ "${{ inputs.table-buckets-mode }}" = "true" ]; then
table_buckets_mode="-t"
fi
region=""
if [ -n "${{ inputs.region }}" ]; then
region="-r ${{ inputs.region }}"
fi
cls3 $buckets $force $quiet $old_versions_only $directory_buckets_mode $table_buckets_mode $region
fi