Skip to content

Commit 3591e47

Browse files
committed
test
1 parent b5f7860 commit 3591e47

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

.github/workflows/ghcr-prune.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
const versions = await github.paginate(listFn, listParams);
7878
core.info(`Found ${versions.length} versions`);
7979
80-
const hashRegex = /^[0-9a-f]{40}$/i;
80+
const hashRegex = /^(?:sha256:)?[0-9a-f]{7,64}$/i;
8181
let deleted = 0;
8282
for (const version of versions) {
8383
const created = new Date(version.created_at).getTime();
@@ -86,7 +86,16 @@ jobs:
8686
}
8787
8888
const tags = version.metadata?.container?.tags ?? [];
89-
const hasCommitTag = tags.some(tag => hashRegex.test(tag));
89+
const digest = version.metadata?.container?.digest;
90+
const identifiers = [...tags];
91+
if (digest) {
92+
identifiers.push(digest);
93+
}
94+
if (version.name) {
95+
identifiers.push(version.name);
96+
}
97+
98+
const hasCommitTag = identifiers.some(id => hashRegex.test(id));
9099
if (!hasCommitTag) {
91100
continue;
92101
}

0 commit comments

Comments
 (0)