mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-05-21 23:59:54 +02:00
Add actions/cache/check action
This commit is contained in:
parent
537862ffdb
commit
9dd99b0404
9 changed files with 61502 additions and 11 deletions
|
@ -0,0 +1,10 @@
|
|||
import restoreImpl from "./restoreImpl";
|
||||
import { NullStateProvider } from "./stateProvider";
|
||||
|
||||
async function run(): Promise<void> {
|
||||
await restoreImpl(new NullStateProvider(), { lookupOnly: true });
|
||||
}
|
||||
|
||||
run();
|
||||
|
||||
export default run;
|
11
src/options.ts
Normal file
11
src/options.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* Options to control cache restore
|
||||
*/
|
||||
export interface RestoreOptions {
|
||||
/**
|
||||
* Weather to skip downloading the cache entry.
|
||||
* If lookupOnly is set to true, the restore function will only check if
|
||||
* a matching cache entry exists.
|
||||
*/
|
||||
lookupOnly?: boolean;
|
||||
}
|
|
@ -2,11 +2,13 @@ import * as cache from "@actions/cache";
|
|||
import * as core from "@actions/core";
|
||||
|
||||
import { Events, Inputs, Outputs, State } from "./constants";
|
||||
import { RestoreOptions } from "./options";
|
||||
import { IStateProvider } from "./stateProvider";
|
||||
import * as utils from "./utils/actionUtils";
|
||||
|
||||
async function restoreImpl(
|
||||
stateProvider: IStateProvider
|
||||
stateProvider: IStateProvider,
|
||||
restoreOptions?: RestoreOptions
|
||||
): Promise<string | undefined> {
|
||||
try {
|
||||
if (!utils.isCacheFeatureAvailable()) {
|
||||
|
@ -40,7 +42,7 @@ async function restoreImpl(
|
|||
cachePaths,
|
||||
primaryKey,
|
||||
restoreKeys,
|
||||
{},
|
||||
{ lookupOnly: restoreOptions?.lookupOnly },
|
||||
enableCrossOsArchive
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue