Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/clean_tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ do
echo "Checking image $image_name..."
escaped_image_name=$(echo ${image_name} | sed "s/\//%2f/g")
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")
message=$(echo $response | jq -r .message)
if [[ $message == "null" ]]; then
version_id=$( | jq -r ".[] | select(.metadata.container.tags | index(\"${tag}\")) | .id")
message=$(echo "$response" | jq -r ".message?")
if [[ -z "$message" || "$message" == "null" ]]; then
version_id=$(echo "$response" | jq -r ".[] | select(.metadata.container.tags | index(\"${tag}\")) | .id")
if [[ -n $version_id ]]; then
echo "Found version '$version_id' for '$image_name:$tag' - deleting..."
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"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/clean_untagged.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ do
echo "Checking for untagged versions for $image_name"
escaped_image_name=$(echo ${image_name} | sed "s/\//%2f/g")
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")
message=$(echo $response | jq -r ".message?")
message=$(echo "$response" | jq -r ".message?")
if [[ -z "$message" || "$message" == "null" ]]; then
version_ids=$( | jq -r ".[] | select(.metadata.container.tags | length ==0) | .id")
version_ids=$(echo "$response" | jq -r ".[] | select(.metadata.container.tags | length ==0) | .id")
for version_id in ${version_ids[@]};
do
echo -e "\tDeleting version '$version_id' for '$image_name:$tag' ..."
Expand Down