mirror of
https://code.forgejo.org/actions/cache.git
synced 2026-01-04 19:08:52 +00:00
RunsOn implem
This commit is contained in:
parent
13aacd865c
commit
e477012777
11 changed files with 140945 additions and 44 deletions
|
|
@ -9,6 +9,9 @@ import {
|
|||
} from "./stateProvider";
|
||||
import * as utils from "./utils/actionUtils";
|
||||
|
||||
import * as custom from "./custom/cache";
|
||||
const canSaveToS3 = process.env["RUNS_ON_S3_BUCKET_CACHE"] !== undefined;
|
||||
|
||||
export async function restoreImpl(
|
||||
stateProvider: IStateProvider
|
||||
): Promise<string | undefined> {
|
||||
|
|
@ -41,13 +44,27 @@ export async function restoreImpl(
|
|||
const failOnCacheMiss = utils.getInputAsBool(Inputs.FailOnCacheMiss);
|
||||
const lookupOnly = utils.getInputAsBool(Inputs.LookupOnly);
|
||||
|
||||
const cacheKey = await cache.restoreCache(
|
||||
cachePaths,
|
||||
primaryKey,
|
||||
restoreKeys,
|
||||
{ lookupOnly: lookupOnly },
|
||||
enableCrossOsArchive
|
||||
);
|
||||
let cacheKey: string | undefined;
|
||||
|
||||
if (canSaveToS3) {
|
||||
core.info(
|
||||
"The cache action detected a local S3 bucket cache. Using it."
|
||||
);
|
||||
cacheKey = await custom.restoreCache(
|
||||
cachePaths,
|
||||
primaryKey,
|
||||
restoreKeys,
|
||||
{ lookupOnly: lookupOnly }
|
||||
);
|
||||
} else {
|
||||
cacheKey = await cache.restoreCache(
|
||||
cachePaths,
|
||||
primaryKey,
|
||||
restoreKeys,
|
||||
{ lookupOnly: lookupOnly },
|
||||
enableCrossOsArchive
|
||||
);
|
||||
}
|
||||
|
||||
if (!cacheKey) {
|
||||
if (failOnCacheMiss) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue