From b0a3f6e7a6068d41aabaae75f3a49a51c5a545ef Mon Sep 17 00:00:00 2001 From: Ella Kramer Date: Fri, 19 Jul 2024 17:16:09 -0400 Subject: [PATCH] Update typescript files to implement cachePath --- src/constants.ts | 6 ++++-- src/restoreImpl.ts | 2 ++ src/stateProvider.ts | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 0158ae0..771dbed 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -11,12 +11,14 @@ export enum Inputs { export enum Outputs { CacheHit = "cache-hit", // Output from cache, 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 { CachePrimaryKey = "CACHE_KEY", - CacheMatchedKey = "CACHE_RESULT" + CacheMatchedKey = "CACHE_RESULT", + CachePath = "CACHE_PATH" } export enum Events { diff --git a/src/restoreImpl.ts b/src/restoreImpl.ts index 74a366d..2ef2c51 100644 --- a/src/restoreImpl.ts +++ b/src/restoreImpl.ts @@ -32,6 +32,8 @@ export async function restoreImpl( const primaryKey = core.getInput(Inputs.Key, { required: true }); 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 cachePaths = utils.getInputAsArray(Inputs.Path, { required: true diff --git a/src/stateProvider.ts b/src/stateProvider.ts index beb41e5..60c28b4 100644 --- a/src/stateProvider.ts +++ b/src/stateProvider.ts @@ -35,7 +35,8 @@ export class StateProvider extends StateProviderBase { export class NullStateProvider extends StateProviderBase { stateToOutputMap = new Map([ [State.CacheMatchedKey, Outputs.CacheMatchedKey], - [State.CachePrimaryKey, Outputs.CachePrimaryKey] + [State.CachePrimaryKey, Outputs.CachePrimaryKey], + [State.CachePath, Outputs.CachePath] ]); setState = (key: string, value: string) => {