diff --git a/dist/restore/index.js b/dist/restore/index.js index 5d5bf18..8aae9cc 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -6374,11 +6374,12 @@ function findObject(mc, bucket, keys, compressionMethod) { core.debug(`Finding object with prefix: ${key}`); let objects = yield listObjects(mc, bucket, key); objects = objects.filter((o) => o.name.includes(fn)); + core.debug(`Found ${JSON.stringify(objects, null, 2)}`); if (objects.length < 1) { continue; } const sorted = objects.sort((a, b) => b.lastModified.getTime() - a.lastModified.getTime()); - core.debug(`Found object ${JSON.stringify(sorted[0])}`); + core.debug(`Using latest ${JSON.stringify(sorted[0])}`); return sorted[0]; } throw new Error("Cache item not found"); diff --git a/dist/save/index.js b/dist/save/index.js index 920e29b..1e4c13e 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -6374,11 +6374,12 @@ function findObject(mc, bucket, keys, compressionMethod) { core.debug(`Finding object with prefix: ${key}`); let objects = yield listObjects(mc, bucket, key); objects = objects.filter((o) => o.name.includes(fn)); + core.debug(`Found ${JSON.stringify(objects, null, 2)}`); if (objects.length < 1) { continue; } const sorted = objects.sort((a, b) => b.lastModified.getTime() - a.lastModified.getTime()); - core.debug(`Found object ${JSON.stringify(sorted[0])}`); + core.debug(`Using latest ${JSON.stringify(sorted[0])}`); return sorted[0]; } throw new Error("Cache item not found"); diff --git a/src/utils.test.ts b/src/utils.test.ts index a7a640d..2844514 100644 --- a/src/utils.test.ts +++ b/src/utils.test.ts @@ -12,7 +12,7 @@ describe("utils", () => { const got = await findObject( mc, "actions-cache", - ["test-Linux-"], + ["foo.bar", "test-Linux-"], await getCompressionMethod() ); expect(got).toBeTruthy(); diff --git a/src/utils.ts b/src/utils.ts index 354a2d5..997d5b2 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -71,13 +71,14 @@ export async function findObject( core.debug(`Finding object with prefix: ${key}`); let objects = await listObjects(mc, bucket, key); objects = objects.filter((o) => o.name.includes(fn)); + core.debug(`Found ${JSON.stringify(objects, null, 2)}`); if (objects.length < 1) { continue; } const sorted = objects.sort( (a, b) => b.lastModified.getTime() - a.lastModified.getTime() ); - core.debug(`Found object ${JSON.stringify(sorted[0])}`); + core.debug(`Using latest ${JSON.stringify(sorted[0])}`); return sorted[0]; } throw new Error("Cache item not found");