Skip to content

Commit c900640

Browse files
n3rdc4ptnCopilot
andauthored
Update .github/workflows/clean-main-images.yml
Co-authored-by: Copilot <[email protected]>
1 parent 59bd792 commit c900640

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/clean-main-images.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,25 @@ jobs:
4343
echo "Deleting the following tags:"
4444
echo "$TO_DELETE" | awk '{print $2}'
4545
46+
FAILED_DELETIONS=""
4647
while read -r line; do
4748
id=$(echo "$line" | awk '{print $1}')
4849
tag=$(echo "$line" | awk '{print $2}')
4950
echo "Deleting tag $tag (version ID $id)"
50-
gh api -X DELETE -H "Accept: application/vnd.github+json" \
51-
/orgs/${{ env.ORG }}/packages/container/${{ env.IMAGE_NAME }}/versions/$id || echo "Failed to delete version $id ($tag)"
51+
if ! gh api -X DELETE -H "Accept: application/vnd.github+json" \
52+
/orgs/${{ env.ORG }}/packages/container/${{ env.IMAGE_NAME }}/versions/$id; then
53+
echo "Failed to delete version $id ($tag)"
54+
FAILED_DELETIONS="${FAILED_DELETIONS}\n$id ($tag)"
55+
fi
56+
echo "Failed to delete version $id ($tag)"
57+
FAILED_DELETIONS="${FAILED_DELETIONS}\n$id ($tag)"
58+
fi
5259
done <<< "$TO_DELETE"
5360
61+
if [ -n "$FAILED_DELETIONS" ]; then
62+
echo -e "The following deletions failed:\n$FAILED_DELETIONS"
63+
exit 1
64+
fi
5465
- name: List remaining ${{ env.TAG_PREFIX }}* tags and their version IDs (debug)
5566
run: |
5667
gh api -H "Accept: application/vnd.github+json" \

0 commit comments

Comments
 (0)