From a5fbe79711984e1c07ddd2bb76d0598483cdc791 Mon Sep 17 00:00:00 2001 From: Tanuj Kumar Mishra Date: Wed, 7 Dec 2022 17:07:30 +0000 Subject: [PATCH] adding outputs --- dist/restore/index.js | 2 ++ dist/save/index.js | 2 ++ restore/action.yml | 6 ++++++ save/action.yml | 3 +++ src/constants.ts | 4 +++- src/restoreImpl.ts | 4 +++- 6 files changed, 19 insertions(+), 2 deletions(-) diff --git a/dist/restore/index.js b/dist/restore/index.js index a2395fe..e2aee1d 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -47582,6 +47582,8 @@ var Inputs; var Outputs; (function (Outputs) { Outputs["CacheHit"] = "cache-hit"; + Outputs["Key"] = "key"; + Outputs["MatchedKey"] = "matched-key"; })(Outputs = exports.Outputs || (exports.Outputs = {})); var State; (function (State) { diff --git a/dist/save/index.js b/dist/save/index.js index 6f71f33..5247d40 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -4975,6 +4975,8 @@ var Inputs; var Outputs; (function (Outputs) { Outputs["CacheHit"] = "cache-hit"; + Outputs["Key"] = "key"; + Outputs["MatchedKey"] = "matched-key"; })(Outputs = exports.Outputs || (exports.Outputs = {})); var State; (function (State) { diff --git a/restore/action.yml b/restore/action.yml index deb8f10..24423ef 100644 --- a/restore/action.yml +++ b/restore/action.yml @@ -14,6 +14,12 @@ inputs: outputs: cache-hit: description: 'A boolean value to indicate an exact match was found for the primary key' + key: + description: 'Key passed in the input to use in subsequent steps of the workflow' + required: true + matched-key: + description: 'Cache key restored' + required: true runs: using: 'node16' main: '../dist/restore/index.js' diff --git a/save/action.yml b/save/action.yml index 614f480..4673c0d 100644 --- a/save/action.yml +++ b/save/action.yml @@ -11,6 +11,9 @@ inputs: upload-chunk-size: description: 'The chunk size used to split up large files during upload, in bytes' required: false + matched-key: + description: 'Cache key restored from the restore action' + required: false runs: using: 'node16' main: '../dist/save/index.js' diff --git a/src/constants.ts b/src/constants.ts index 133f47d..c9c8a81 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -6,7 +6,9 @@ export enum Inputs { } export enum Outputs { - CacheHit = "cache-hit" + CacheHit = "cache-hit", + Key = "key", + MatchedKey = "matched-key" } export enum State { diff --git a/src/restoreImpl.ts b/src/restoreImpl.ts index 402f5f9..dec2437 100644 --- a/src/restoreImpl.ts +++ b/src/restoreImpl.ts @@ -5,7 +5,9 @@ import { Events, Inputs, Outputs, State } from "./constants"; import { IStateProvider } from "./stateProvider"; import * as utils from "./utils/actionUtils"; -async function restoreImpl(stateProvider: IStateProvider): Promise { +async function restoreImpl( + stateProvider: IStateProvider +): Promise { try { if (!utils.isCacheFeatureAvailable()) { utils.setCacheHitOutput(false);