We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 63b1251 commit f235371Copy full SHA for f235371
1 file changed
.github/workflows/cleanup-ghcr.yml
@@ -29,15 +29,14 @@ jobs:
29
env:
30
OWNER: ${{ github.repository_owner }}
31
IMAGE: deep-learning-crash-course
32
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33
run: |
34
echo "Fetching all versions of $OWNER/$IMAGE..."
35
versions=$(gh api --paginate -H "Accept: application/vnd.github.v3+json" \
36
/orgs/$OWNER/packages/container/$IMAGE/versions)
- # find the newest by creation timestamp
37
newest_id=$(echo "$versions" \
38
| jq -r 'sort_by(.created_at) | reverse | .[0].id')
39
echo "🛡 Keeping version $newest_id (most recent)"
40
- # loop through all and delete those that aren't the newest
41
echo "$versions" | jq -c '.[]' | while read ver; do
42
id=$(echo "$ver" | jq -r '.id')
43
if [ "$id" != "$newest_id" ]; then
@@ -48,3 +47,4 @@ jobs:
48
47
fi
49
done
50
+
0 commit comments