From c8d01facfc3ff09a9c647238b5d7db09f02bfe2d Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Wed, 14 Dec 2022 09:17:49 +0000 Subject: [PATCH] Renamed output --- __tests__/restoreOnly.test.ts | 4 ++-- dist/restore-only/index.js | 4 ++-- dist/restore/index.js | 4 ++-- dist/save-only/index.js | 4 ++-- dist/save/index.js | 4 ++-- restore/action.yml | 4 ++-- src/constants.ts | 2 +- src/stateProvider.ts | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/__tests__/restoreOnly.test.ts b/__tests__/restoreOnly.test.ts index fa9d685..386ae38 100644 --- a/__tests__/restoreOnly.test.ts +++ b/__tests__/restoreOnly.test.ts @@ -132,7 +132,7 @@ test("restore with cache found for key", async () => { expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key); expect(outputMock).toHaveBeenCalledWith("cache-hit", "true"); - expect(outputMock).toHaveBeenCalledWith("cache-restore-key", key); + expect(outputMock).toHaveBeenCalledWith("cache-matched-key", key); expect(outputMock).toHaveBeenCalledTimes(3); @@ -166,7 +166,7 @@ test("restore with cache found for restore key", async () => { expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key); expect(outputMock).toHaveBeenCalledWith("cache-hit", "false"); - expect(outputMock).toHaveBeenCalledWith("cache-restore-key", restoreKey); + expect(outputMock).toHaveBeenCalledWith("cache-matched-key", restoreKey); expect(outputMock).toHaveBeenCalledTimes(3); diff --git a/dist/restore-only/index.js b/dist/restore-only/index.js index ffed496..cf72416 100644 --- a/dist/restore-only/index.js +++ b/dist/restore-only/index.js @@ -4957,7 +4957,7 @@ var Outputs; (function (Outputs) { Outputs["CacheHit"] = "cache-hit"; Outputs["CachePrimaryKey"] = "cache-primary-key"; - Outputs["CacheRestoreKey"] = "cache-restore-key"; // Output from restore action + Outputs["CacheMatchedKey"] = "cache-matched-key"; // Output from restore action })(Outputs = exports.Outputs || (exports.Outputs = {})); var State; (function (State) { @@ -9387,7 +9387,7 @@ class NullStateProvider extends StateProviderBase { constructor() { super(...arguments); this.stateToOutputMap = new Map([ - [constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheRestoreKey], + [constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheMatchedKey], [constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey] ]); this.setState = (key, value) => { diff --git a/dist/restore/index.js b/dist/restore/index.js index 82d7c2e..5d3a662 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -4957,7 +4957,7 @@ var Outputs; (function (Outputs) { Outputs["CacheHit"] = "cache-hit"; Outputs["CachePrimaryKey"] = "cache-primary-key"; - Outputs["CacheRestoreKey"] = "cache-restore-key"; // Output from restore action + Outputs["CacheMatchedKey"] = "cache-matched-key"; // Output from restore action })(Outputs = exports.Outputs || (exports.Outputs = {})); var State; (function (State) { @@ -9387,7 +9387,7 @@ class NullStateProvider extends StateProviderBase { constructor() { super(...arguments); this.stateToOutputMap = new Map([ - [constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheRestoreKey], + [constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheMatchedKey], [constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey] ]); this.setState = (key, value) => { diff --git a/dist/save-only/index.js b/dist/save-only/index.js index 638bb7d..42f8457 100644 --- a/dist/save-only/index.js +++ b/dist/save-only/index.js @@ -4986,7 +4986,7 @@ var Outputs; (function (Outputs) { Outputs["CacheHit"] = "cache-hit"; Outputs["CachePrimaryKey"] = "cache-primary-key"; - Outputs["CacheRestoreKey"] = "cache-restore-key"; // Output from restore action + Outputs["CacheMatchedKey"] = "cache-matched-key"; // Output from restore action })(Outputs = exports.Outputs || (exports.Outputs = {})); var State; (function (State) { @@ -9416,7 +9416,7 @@ class NullStateProvider extends StateProviderBase { constructor() { super(...arguments); this.stateToOutputMap = new Map([ - [constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheRestoreKey], + [constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheMatchedKey], [constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey] ]); this.setState = (key, value) => { diff --git a/dist/save/index.js b/dist/save/index.js index 4501bcb..d5c5f68 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -4957,7 +4957,7 @@ var Outputs; (function (Outputs) { Outputs["CacheHit"] = "cache-hit"; Outputs["CachePrimaryKey"] = "cache-primary-key"; - Outputs["CacheRestoreKey"] = "cache-restore-key"; // Output from restore action + Outputs["CacheMatchedKey"] = "cache-matched-key"; // Output from restore action })(Outputs = exports.Outputs || (exports.Outputs = {})); var State; (function (State) { @@ -9387,7 +9387,7 @@ class NullStateProvider extends StateProviderBase { constructor() { super(...arguments); this.stateToOutputMap = new Map([ - [constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheRestoreKey], + [constants_1.State.CacheMatchedKey, constants_1.Outputs.CacheMatchedKey], [constants_1.State.CachePrimaryKey, constants_1.Outputs.CachePrimaryKey] ]); this.setState = (key, value) => { diff --git a/restore/action.yml b/restore/action.yml index 4eb3c5a..36fa175 100644 --- a/restore/action.yml +++ b/restore/action.yml @@ -16,8 +16,8 @@ outputs: description: 'A boolean value to indicate an exact match was found for the primary key' cache-primary-key: description: 'A resolved cache key for which cache match was attempted' - cache-restore-key: - description: 'Restore key which was used to restore the cache. It will not be set in case there was an exact match with primary key itself' + cache-matched-key: + description: 'Key of the cache that was restored, it could either be the primary key on cache-hit or a partial/complete match of one of the restore keys' runs: using: 'node16' main: '../dist/restore-only/index.js' diff --git a/src/constants.ts b/src/constants.ts index 0c5b610..8e749ee 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -8,7 +8,7 @@ export enum Inputs { export enum Outputs { CacheHit = "cache-hit", // Output from cache, restore action CachePrimaryKey = "cache-primary-key", // Output from restore action - CacheRestoreKey = "cache-restore-key" // Output from restore action + CacheMatchedKey = "cache-matched-key" // Output from restore action } export enum State { diff --git a/src/stateProvider.ts b/src/stateProvider.ts index 3409999..beb41e5 100644 --- a/src/stateProvider.ts +++ b/src/stateProvider.ts @@ -34,7 +34,7 @@ export class StateProvider extends StateProviderBase { export class NullStateProvider extends StateProviderBase { stateToOutputMap = new Map([ - [State.CacheMatchedKey, Outputs.CacheRestoreKey], + [State.CacheMatchedKey, Outputs.CacheMatchedKey], [State.CachePrimaryKey, Outputs.CachePrimaryKey] ]);