Skip to content

Commit c847b2f

Browse files
committed
Fix scripts
1 parent ced74db commit c847b2f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

.github/workflows/clean_tags.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ do
5757
echo "Checking image $image_name..."
5858
escaped_image_name=$(echo ${image_name} | sed "s/\//%2f/g")
5959
response=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/orgs/devcontainers/packages/container/$escaped_image_name/versions")
60-
message=$(echo $response | jq -r .message)
61-
if [[ $message == "null" ]]; then
62-
version_id=$( | jq -r ".[] | select(.metadata.container.tags | index(\"${tag}\")) | .id")
60+
message=$(echo "$response" | jq -r ".message?")
61+
if [[ -z "$message" || "$message" == "null" ]]; then
62+
version_id=$(echo "$response" | jq -r ".[] | select(.metadata.container.tags | index(\"${tag}\")) | .id")
6363
if [[ -n $version_id ]]; then
6464
echo "Found version '$version_id' for '$image_name:$tag' - deleting..."
6565
curl -s -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/orgs/devcontainers/packages/container/$escaped_image_name/versions/$version_id"

.github/workflows/clean_untagged.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ do
1818
echo "Checking for untagged versions for $image_name"
1919
escaped_image_name=$(echo ${image_name} | sed "s/\//%2f/g")
2020
response=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/orgs/devcontainers/packages/container/$escaped_image_name/versions?per_page=100")
21-
message=$(echo $response | jq -r ".message?")
21+
message=$(echo "$response" | jq -r ".message?")
2222
if [[ -z "$message" || "$message" == "null" ]]; then
23-
version_ids=$( | jq -r ".[] | select(.metadata.container.tags | length ==0) | .id")
23+
version_ids=$(echo "$response" | jq -r ".[] | select(.metadata.container.tags | length ==0) | .id")
2424
for version_id in ${version_ids[@]};
2525
do
2626
echo -e "\tDeleting version '$version_id' for '$image_name:$tag' ..."

0 commit comments

Comments
 (0)