Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scripts #265

Merged
merged 1 commit into from
Nov 9, 2023
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
Loading