diff --git a/dist/restore/index.js b/dist/restore/index.js index c8c999e1a..5e11505ab 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -4935,6 +4935,8 @@ var Inputs; var Outputs; (function (Outputs) { Outputs["CacheHit"] = "cache-hit"; + Outputs["ExactCacheHit"] = "exact-cache-hit"; + Outputs["FuzzyCacheHit"] = "fuzzy-cache-hit"; })(Outputs = exports.Outputs || (exports.Outputs = {})); var State; (function (State) { @@ -38382,7 +38384,7 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.isCacheFeatureAvailable = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0; +exports.isCacheFeatureAvailable = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setFuzzyCacheHitOutput = exports.setExactCacheHitOutput = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0; const cache = __importStar(__webpack_require__(692)); const core = __importStar(__webpack_require__(470)); const constants_1 = __webpack_require__(196); @@ -38406,6 +38408,14 @@ function setCacheHitOutput(isCacheHit) { core.setOutput(constants_1.Outputs.CacheHit, isCacheHit.toString()); } exports.setCacheHitOutput = setCacheHitOutput; +function setExactCacheHitOutput(isCacheHit) { + core.setOutput(constants_1.Outputs.ExactCacheHit, isCacheHit.toString()); +} +exports.setExactCacheHitOutput = setExactCacheHitOutput; +function setFuzzyCacheHitOutput(isCacheHit) { + core.setOutput(constants_1.Outputs.FuzzyCacheHit, isCacheHit.toString()); +} +exports.setFuzzyCacheHitOutput = setFuzzyCacheHitOutput; function setOutputAndState(key, cacheKey) { setCacheHitOutput(isExactKeyMatch(key, cacheKey)); // Store the matched cache key if it exists @@ -48956,6 +48966,8 @@ function run() { try { if (!utils.isCacheFeatureAvailable()) { utils.setCacheHitOutput(false); + utils.setExactCacheHitOutput(false); + utils.setFuzzyCacheHitOutput(false); return; } // Validate inputs, this can cause task failure @@ -48980,7 +48992,9 @@ function run() { // Store the matched cache key utils.setCacheState(cacheKey); const isExactKeyMatch = utils.isExactKeyMatch(primaryKey, cacheKey); - utils.setCacheHitOutput(isExactKeyMatch); + utils.setCacheHitOutput(true); + utils.setExactCacheHitOutput(isExactKeyMatch); + utils.setFuzzyCacheHitOutput(!isExactKeyMatch); core.info(`Cache restored from key: ${cacheKey}`); } catch (error) { diff --git a/dist/save/index.js b/dist/save/index.js index 0fbc6d406..974787710 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -4935,6 +4935,8 @@ var Inputs; var Outputs; (function (Outputs) { Outputs["CacheHit"] = "cache-hit"; + Outputs["ExactCacheHit"] = "exact-cache-hit"; + Outputs["FuzzyCacheHit"] = "fuzzy-cache-hit"; })(Outputs = exports.Outputs || (exports.Outputs = {})); var State; (function (State) { @@ -38382,7 +38384,7 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.isCacheFeatureAvailable = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0; +exports.isCacheFeatureAvailable = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setFuzzyCacheHitOutput = exports.setExactCacheHitOutput = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0; const cache = __importStar(__webpack_require__(692)); const core = __importStar(__webpack_require__(470)); const constants_1 = __webpack_require__(196); @@ -38406,6 +38408,14 @@ function setCacheHitOutput(isCacheHit) { core.setOutput(constants_1.Outputs.CacheHit, isCacheHit.toString()); } exports.setCacheHitOutput = setCacheHitOutput; +function setExactCacheHitOutput(isCacheHit) { + core.setOutput(constants_1.Outputs.ExactCacheHit, isCacheHit.toString()); +} +exports.setExactCacheHitOutput = setExactCacheHitOutput; +function setFuzzyCacheHitOutput(isCacheHit) { + core.setOutput(constants_1.Outputs.FuzzyCacheHit, isCacheHit.toString()); +} +exports.setFuzzyCacheHitOutput = setFuzzyCacheHitOutput; function setOutputAndState(key, cacheKey) { setCacheHitOutput(isExactKeyMatch(key, cacheKey)); // Store the matched cache key if it exists diff --git a/src/constants.ts b/src/constants.ts index 133f47dc0..980a893c3 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", + ExactCacheHit = "exact-cache-hit", + FuzzyCacheHit = "fuzzy-cache-hit" } export enum State { diff --git a/src/restore.ts b/src/restore.ts index 5bc17faef..7a85562d0 100644 --- a/src/restore.ts +++ b/src/restore.ts @@ -8,6 +8,8 @@ async function run(): Promise { try { if (!utils.isCacheFeatureAvailable()) { utils.setCacheHitOutput(false); + utils.setExactCacheHitOutput(false); + utils.setFuzzyCacheHitOutput(false); return; } @@ -50,7 +52,9 @@ async function run(): Promise { utils.setCacheState(cacheKey); const isExactKeyMatch = utils.isExactKeyMatch(primaryKey, cacheKey); - utils.setCacheHitOutput(isExactKeyMatch); + utils.setCacheHitOutput(true); + utils.setExactCacheHitOutput(isExactKeyMatch); + utils.setFuzzyCacheHitOutput(!isExactKeyMatch); core.info(`Cache restored from key: ${cacheKey}`); } catch (error: unknown) { core.setFailed((error as Error).message); diff --git a/src/utils/actionUtils.ts b/src/utils/actionUtils.ts index 034df1958..e47209c3c 100644 --- a/src/utils/actionUtils.ts +++ b/src/utils/actionUtils.ts @@ -27,6 +27,14 @@ export function setCacheHitOutput(isCacheHit: boolean): void { core.setOutput(Outputs.CacheHit, isCacheHit.toString()); } +export function setExactCacheHitOutput(isCacheHit: boolean): void { + core.setOutput(Outputs.ExactCacheHit, isCacheHit.toString()); +} + +export function setFuzzyCacheHitOutput(isCacheHit: boolean): void { + core.setOutput(Outputs.FuzzyCacheHit, isCacheHit.toString()); +} + export function setOutputAndState(key: string, cacheKey?: string): void { setCacheHitOutput(isExactKeyMatch(key, cacheKey)); // Store the matched cache key if it exists