Skip to content

Commit a3aa8b3

Browse files
committed
cpu and gpu
1 parent e31836f commit a3aa8b3

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

.github/workflows/cleanup-ghcr.yml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,38 @@
11
name: "Prune old GHCR images"
22

33
on:
4-
# 1) Run daily at 02:00 UTC
54
schedule:
6-
- cron: '0 2 * * *'
7-
# 2) Also run on every push to main (or your default branch)
5+
- cron: '0 2 * * *' # daily at 02:00 UTC
86
push:
9-
branches:
10-
- docker
11-
7+
branches: [ docker ]
128
permissions:
13-
contents: read # for listing versions
14-
packages: write # for deleting package versions
9+
contents: read
10+
packages: write
1511

1612
jobs:
1713
prune:
1814
runs-on: ubuntu-latest
1915

2016
steps:
21-
- name: Install jq and GitHub CLI
17+
- name: Install dependencies
2218
run: |
2319
sudo apt-get update
2420
sudo apt-get install -y jq
2521
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
2622
| sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
27-
echo \
28-
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] \
29-
https://cli.github.com/packages stable main" \
30-
| sudo tee /etc/apt/sources.list.d/github-cli.list
23+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
24+
| sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
3125
sudo apt-get update
3226
sudo apt-get install -y gh
3327
34-
3528
- name: Delete non-latest versions
3629
env:
3730
OWNER: ${{ github.repository_owner }}
3831
IMAGE: deep-learning-crash-course
3932
run: |
33+
echo "Fetching all versions of $OWNER/$IMAGE…"
4034
gh api -H "Accept: application/vnd.github.v3+json" \
41-
/users/$OWNER/packages/container/$IMAGE/versions \
35+
/orgs/$OWNER/packages/container/$IMAGE/versions \
4236
| jq -c '.[]' \
4337
| while read version; do
4438
id=$(echo "$version" | jq -r '.id')
@@ -47,6 +41,6 @@ jobs:
4741
echo "Deleting version $id (tags: $tags)"
4842
gh api -X DELETE \
4943
-H "Accept: application/vnd.github.v3+json" \
50-
/users/$OWNER/packages/container/$IMAGE/versions/$id
44+
/orgs/$OWNER/packages/container/$IMAGE/versions/$id
5145
fi
5246
done

0 commit comments

Comments
 (0)