Skip to content

Commit 81835ec

Browse files
committed
ci: Add monthly GHCR package cleanup workflow
Deletes untagged container versions and versions older than 6 months from ghcr.io on the 1st of each month. Always retains at least 1 version. Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Nishanth Menon <nm@ti.com>
1 parent fb503a0 commit 81835ec

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Cleanup Old Packages
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 1 * *' # Monthly on the 1st at midnight UTC
6+
workflow_dispatch: # Allow manual trigger
7+
8+
jobs:
9+
cleanup-ghcr:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
packages: write
13+
14+
steps:
15+
- name: Delete untagged package versions from GHCR
16+
uses: actions/delete-package-versions@v5
17+
with:
18+
package-name: arm-kernel-dev
19+
package-type: container
20+
delete-only-untagged-versions: true
21+
22+
- name: Delete GHCR package versions older than 6 months
23+
uses: snok/container-retention-policy@v2
24+
with:
25+
account-type: personal
26+
image-names: arm-kernel-dev
27+
cut-off: 6 months ago UTC
28+
keep-at-least: 1
29+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)