mirror of
https://github.com/actions/cache.git
synced 2025-04-23 14:30:49 +00:00
more options
This commit is contained in:
parent
cbb243eff9
commit
9d956bc62d
4 changed files with 64 additions and 1 deletions
20
dist/restore/index.js
vendored
20
dist/restore/index.js
vendored
|
@ -43417,6 +43417,26 @@ class CacheService {
|
||||||
Prefix: path.join(this.getCacheFolder(), keys[i])
|
Prefix: path.join(this.getCacheFolder(), keys[i])
|
||||||
})
|
})
|
||||||
.promise();
|
.promise();
|
||||||
|
let selected = undefined;
|
||||||
|
if (response.Contents) {
|
||||||
|
for (const object of response.Contents) {
|
||||||
|
if (selected === undefined) {
|
||||||
|
selected = object;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (object.LastModified &&
|
||||||
|
selected.LastModified) {
|
||||||
|
if (object.LastModified >
|
||||||
|
selected.LastModified) {
|
||||||
|
selected = object;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selected && selected.Key) {
|
||||||
|
return path.parse(selected.Key).name;
|
||||||
|
}
|
||||||
|
}
|
||||||
core.debug(JSON.stringify(response));
|
core.debug(JSON.stringify(response));
|
||||||
// eslint-disable-next-line no-empty
|
// eslint-disable-next-line no-empty
|
||||||
}
|
}
|
||||||
|
|
20
dist/save/index.js
vendored
20
dist/save/index.js
vendored
|
@ -43417,6 +43417,26 @@ class CacheService {
|
||||||
Prefix: path.join(this.getCacheFolder(), keys[i])
|
Prefix: path.join(this.getCacheFolder(), keys[i])
|
||||||
})
|
})
|
||||||
.promise();
|
.promise();
|
||||||
|
let selected = undefined;
|
||||||
|
if (response.Contents) {
|
||||||
|
for (const object of response.Contents) {
|
||||||
|
if (selected === undefined) {
|
||||||
|
selected = object;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (object.LastModified &&
|
||||||
|
selected.LastModified) {
|
||||||
|
if (object.LastModified >
|
||||||
|
selected.LastModified) {
|
||||||
|
selected = object;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selected && selected.Key) {
|
||||||
|
return path.parse(selected.Key).name;
|
||||||
|
}
|
||||||
|
}
|
||||||
core.debug(JSON.stringify(response));
|
core.debug(JSON.stringify(response));
|
||||||
// eslint-disable-next-line no-empty
|
// eslint-disable-next-line no-empty
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "cache",
|
"name": "cache",
|
||||||
"version": "0.8.0",
|
"version": "0.9.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Cache dependencies and build outputs",
|
"description": "Cache dependencies and build outputs",
|
||||||
"main": "dist/restore/index.js",
|
"main": "dist/restore/index.js",
|
||||||
|
|
|
@ -182,6 +182,29 @@ export class CacheService {
|
||||||
Prefix: path.join(this.getCacheFolder(), keys[i])
|
Prefix: path.join(this.getCacheFolder(), keys[i])
|
||||||
})
|
})
|
||||||
.promise();
|
.promise();
|
||||||
|
let selected: S3.Object | undefined = undefined;
|
||||||
|
if (response.Contents) {
|
||||||
|
for (const object of response.Contents) {
|
||||||
|
if (selected === undefined) {
|
||||||
|
selected = object;
|
||||||
|
} else {
|
||||||
|
if (
|
||||||
|
object.LastModified &&
|
||||||
|
selected.LastModified
|
||||||
|
) {
|
||||||
|
if (
|
||||||
|
object.LastModified >
|
||||||
|
selected.LastModified
|
||||||
|
) {
|
||||||
|
selected = object;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selected && selected.Key) {
|
||||||
|
return path.parse(selected.Key).name;
|
||||||
|
}
|
||||||
|
}
|
||||||
core.debug(JSON.stringify(response));
|
core.debug(JSON.stringify(response));
|
||||||
// eslint-disable-next-line no-empty
|
// eslint-disable-next-line no-empty
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue