1
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2024-11-24 04:29:16 +01:00

Update typescript files to implement cachePath

This commit is contained in:
Ella Kramer 2024-07-19 17:16:09 -04:00
parent 12b3b8a0b8
commit b0a3f6e7a6
3 changed files with 8 additions and 3 deletions

View file

@ -11,12 +11,14 @@ export enum Inputs {
export enum Outputs { export enum Outputs {
CacheHit = "cache-hit", // Output from cache, restore action CacheHit = "cache-hit", // Output from cache, restore action
CachePrimaryKey = "cache-primary-key", // Output from restore action CachePrimaryKey = "cache-primary-key", // Output from restore action
CacheMatchedKey = "cache-matched-key" // Output from restore action CacheMatchedKey = "cache-matched-key", // Output from restore action
CachePath = "cache-path" // Output from restore action
} }
export enum State { export enum State {
CachePrimaryKey = "CACHE_KEY", CachePrimaryKey = "CACHE_KEY",
CacheMatchedKey = "CACHE_RESULT" CacheMatchedKey = "CACHE_RESULT",
CachePath = "CACHE_PATH"
} }
export enum Events { export enum Events {

View file

@ -32,6 +32,8 @@ export async function restoreImpl(
const primaryKey = core.getInput(Inputs.Key, { required: true }); const primaryKey = core.getInput(Inputs.Key, { required: true });
stateProvider.setState(State.CachePrimaryKey, primaryKey); stateProvider.setState(State.CachePrimaryKey, primaryKey);
stateProvider.setState(State.CachePath, core.getInput(Inputs.Path)); // Output path unchanged from input
const restoreKeys = utils.getInputAsArray(Inputs.RestoreKeys); const restoreKeys = utils.getInputAsArray(Inputs.RestoreKeys);
const cachePaths = utils.getInputAsArray(Inputs.Path, { const cachePaths = utils.getInputAsArray(Inputs.Path, {
required: true required: true

View file

@ -35,7 +35,8 @@ export class StateProvider extends StateProviderBase {
export class NullStateProvider extends StateProviderBase { export class NullStateProvider extends StateProviderBase {
stateToOutputMap = new Map<string, string>([ stateToOutputMap = new Map<string, string>([
[State.CacheMatchedKey, Outputs.CacheMatchedKey], [State.CacheMatchedKey, Outputs.CacheMatchedKey],
[State.CachePrimaryKey, Outputs.CachePrimaryKey] [State.CachePrimaryKey, Outputs.CachePrimaryKey],
[State.CachePath, Outputs.CachePath]
]); ]);
setState = (key: string, value: string) => { setState = (key: string, value: string) => {