Skip to content

Commit 64fb240

Browse files
jiridanekcaponetto
andauthored
ci: implement ghcr.io expiration for images and cache layers (#601)
* ci: implement ghcr.io expiration for images and cache layers * fixups from rewiew, reference action by hash not tag Co-authored-by: Guilherme Caponetto <[email protected]> --------- Co-authored-by: Guilherme Caponetto <[email protected]>
1 parent c1b315b commit 64fb240

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/purge-ghcr.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: "Purge old ghcr.io test images periodically"
3+
4+
"on":
5+
workflow_dispatch:
6+
inputs:
7+
dry_run:
8+
type: boolean
9+
default: true
10+
description: "Do a dry run?"
11+
schedule:
12+
- cron: "0 5 * * *" # at 05:00 every day
13+
14+
permissions:
15+
packages: write
16+
17+
jobs:
18+
clean:
19+
runs-on: ubuntu-latest
20+
name: Delete old test images
21+
steps:
22+
# https://github.com/snok/container-retention-policy?tab=readme-ov-file#parameters
23+
- uses: snok/container-retention-policy@4f22ef80902ad409ed55a99dc5133cc1250a0d03 # v3.0.0
24+
with:
25+
# account must be the gh org name when running for an org, and 'user' when running for a user
26+
account: ${{ (github.repository_owner == github.actor) && 'user' || github.repository_owner }}
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
image-names: |
29+
${{ github.event.repository.name }}/workbench-images
30+
${{ github.event.repository.name }}/workbench-images/build-cache
31+
image-tags: "*"
32+
cut-off: "3w"
33+
dry-run: ${{ inputs.dry_run || false }}
34+
env:
35+
RUST_BACKTRACE: 1

0 commit comments

Comments
 (0)