Skip to content

Commit 94489a4

Browse files
committed
clean up modified
1 parent fea807b commit 94489a4

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

.github/workflows/cleanup-ghcr.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
sudo apt-get update
2929
sudo apt-get install -y gh
3030
31-
- name: Delete all but the newest version for CPU & GPU images
31+
- name: Delete all non-`:latest` versions
3232
env:
3333
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3434
OWNER: ${{ github.repository_owner }}
@@ -42,27 +42,24 @@ jobs:
4242
-H "Accept: application/vnd.github.v3+json" \
4343
/orgs/$OWNER/packages/container/$IMAGE/versions)
4444
45-
# pick most recent by creation date
46-
newest_id=$(echo "$versions" \
47-
| jq -r 'sort_by(.created_at) | reverse | .[0].id')
48-
echo "🛡 Keeping version $newest_id for $IMAGE"
45+
# Only delete versions *not* tagged "latest"
46+
echo "$versions" \
47+
| jq -c '.[] | select((.metadata.container.tags // []) | index("latest") | not)' \
48+
| while read version; do
4949
50-
# delete every version except the newest
51-
echo "$versions" | jq -c '.[]' | while read version; do
52-
id=$(echo "$version" | jq -r '.id')
53-
if [[ "$id" != "$newest_id" ]]; then
54-
echo "→ Deleting version $id of $IMAGE"
50+
id=$(echo "$version" | jq -r '.id')
51+
tags=$(echo "$version" | jq -r '.metadata.container.tags[]')
52+
echo "→ Deleting version $id (tags: $tags)"
5553
for attempt in 1 2 3; do
5654
if gh api -X DELETE \
5755
-H "Accept: application/vnd.github.v3+json" \
5856
/orgs/$OWNER/packages/container/$IMAGE/versions/$id; then
5957
echo " ✅ Deleted $id"
6058
break
6159
else
62-
echo " ⚠️ Attempt $attempt failed, retrying in $((5*attempt))s…"
60+
echo " ⚠️ Attempt $attempt failed, retrying…"
6361
sleep $((5*attempt))
6462
fi
6563
done
66-
fi
67-
done
68-
done
64+
done
65+
done

docker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ After startup, copy the URL with token (e.g., http://127.0.0.1:8888/lab?token=
7171

7272
5. **Open Folder**`/home/jovyan/work` and **Select Kernel**`/opt/conda/bin/python` (Python 3.11).
7373

74-
6. Open any `.ipynb` and run cells.
74+
6. Open any `.ipynb` and run cells. If `ipywidgets` fails, Reload window.

0 commit comments

Comments
 (0)