From 1ddc49105de28795736c1e98c4413738eb69debc Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Mon, 12 Dec 2022 14:03:16 +0000 Subject: [PATCH] Removed unused code --- __tests__/restoreImpl.test.ts | 8 ++++---- dist/restore-only/index.js | 8 ++------ dist/restore/index.js | 8 ++------ dist/save-only/index.js | 6 +----- dist/save/index.js | 6 +----- src/restoreImpl.ts | 2 +- src/utils/actionUtils.ts | 6 +----- 7 files changed, 12 insertions(+), 32 deletions(-) diff --git a/__tests__/restoreImpl.test.ts b/__tests__/restoreImpl.test.ts index 66bab8d..47a9e52 100644 --- a/__tests__/restoreImpl.test.ts +++ b/__tests__/restoreImpl.test.ts @@ -66,13 +66,13 @@ test("restore without AC available should no-op", async () => { ); const restoreCacheMock = jest.spyOn(cache, "restoreCache"); - const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput"); + const setCacheHitOutputMock = jest.spyOn(core, "setOutput"); await run(new StateProvider()); expect(restoreCacheMock).toHaveBeenCalledTimes(0); expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1); - expect(setCacheHitOutputMock).toHaveBeenCalledWith(false); + expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "false"); }); test("restore on GHES without AC available should no-op", async () => { @@ -82,13 +82,13 @@ test("restore on GHES without AC available should no-op", async () => { ); const restoreCacheMock = jest.spyOn(cache, "restoreCache"); - const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput"); + const setCacheHitOutputMock = jest.spyOn(core, "setOutput"); await run(new StateProvider()); expect(restoreCacheMock).toHaveBeenCalledTimes(0); expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1); - expect(setCacheHitOutputMock).toHaveBeenCalledWith(false); + expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "false"); }); test("restore on GHES with AC available ", async () => { diff --git a/dist/restore-only/index.js b/dist/restore-only/index.js index 0192c06..f9a179e 100644 --- a/dist/restore-only/index.js +++ b/dist/restore-only/index.js @@ -10045,7 +10045,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.setCacheHitOutput = exports.isExactKeyMatch = exports.isGhes = void 0; +exports.isCacheFeatureAvailable = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.isExactKeyMatch = exports.isGhes = void 0; const cache = __importStar(__webpack_require__(692)); const core = __importStar(__webpack_require__(470)); const constants_1 = __webpack_require__(196); @@ -10061,10 +10061,6 @@ function isExactKeyMatch(key, cacheKey) { }) === 0); } exports.isExactKeyMatch = isExactKeyMatch; -function setCacheHitOutput(isCacheHit) { - core.setOutput(constants_1.Outputs.CacheHit, isCacheHit.toString()); -} -exports.setCacheHitOutput = setCacheHitOutput; function logWarning(message) { const warningPrefix = "[warning]"; core.info(`${warningPrefix}${message}`); @@ -50459,7 +50455,7 @@ function restoreImpl(stateProvider) { return __awaiter(this, void 0, void 0, function* () { try { if (!utils.isCacheFeatureAvailable()) { - utils.setCacheHitOutput(false); + core.setOutput(constants_1.Outputs.CacheHit, "false"); return; } // Validate inputs, this can cause task failure diff --git a/dist/restore/index.js b/dist/restore/index.js index 8638fbe..50f3443 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -38565,7 +38565,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.setCacheHitOutput = exports.isExactKeyMatch = exports.isGhes = void 0; +exports.isCacheFeatureAvailable = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.isExactKeyMatch = exports.isGhes = void 0; const cache = __importStar(__webpack_require__(692)); const core = __importStar(__webpack_require__(470)); const constants_1 = __webpack_require__(196); @@ -38581,10 +38581,6 @@ function isExactKeyMatch(key, cacheKey) { }) === 0); } exports.isExactKeyMatch = isExactKeyMatch; -function setCacheHitOutput(isCacheHit) { - core.setOutput(constants_1.Outputs.CacheHit, isCacheHit.toString()); -} -exports.setCacheHitOutput = setCacheHitOutput; function logWarning(message) { const warningPrefix = "[warning]"; core.info(`${warningPrefix}${message}`); @@ -50459,7 +50455,7 @@ function restoreImpl(stateProvider) { return __awaiter(this, void 0, void 0, function* () { try { if (!utils.isCacheFeatureAvailable()) { - utils.setCacheHitOutput(false); + core.setOutput(constants_1.Outputs.CacheHit, "false"); return; } // Validate inputs, this can cause task failure diff --git a/dist/save-only/index.js b/dist/save-only/index.js index f417c7a..5b244a2 100644 --- a/dist/save-only/index.js +++ b/dist/save-only/index.js @@ -38589,7 +38589,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.setCacheHitOutput = exports.isExactKeyMatch = exports.isGhes = void 0; +exports.isCacheFeatureAvailable = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.isExactKeyMatch = exports.isGhes = void 0; const cache = __importStar(__webpack_require__(692)); const core = __importStar(__webpack_require__(470)); const constants_1 = __webpack_require__(196); @@ -38605,10 +38605,6 @@ function isExactKeyMatch(key, cacheKey) { }) === 0); } exports.isExactKeyMatch = isExactKeyMatch; -function setCacheHitOutput(isCacheHit) { - core.setOutput(constants_1.Outputs.CacheHit, isCacheHit.toString()); -} -exports.setCacheHitOutput = setCacheHitOutput; function logWarning(message) { const warningPrefix = "[warning]"; core.info(`${warningPrefix}${message}`); diff --git a/dist/save/index.js b/dist/save/index.js index c11e5fb..af26def 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -38560,7 +38560,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.setCacheHitOutput = exports.isExactKeyMatch = exports.isGhes = void 0; +exports.isCacheFeatureAvailable = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.isExactKeyMatch = exports.isGhes = void 0; const cache = __importStar(__webpack_require__(692)); const core = __importStar(__webpack_require__(470)); const constants_1 = __webpack_require__(196); @@ -38576,10 +38576,6 @@ function isExactKeyMatch(key, cacheKey) { }) === 0); } exports.isExactKeyMatch = isExactKeyMatch; -function setCacheHitOutput(isCacheHit) { - core.setOutput(constants_1.Outputs.CacheHit, isCacheHit.toString()); -} -exports.setCacheHitOutput = setCacheHitOutput; function logWarning(message) { const warningPrefix = "[warning]"; core.info(`${warningPrefix}${message}`); diff --git a/src/restoreImpl.ts b/src/restoreImpl.ts index dec2437..fb43517 100644 --- a/src/restoreImpl.ts +++ b/src/restoreImpl.ts @@ -10,7 +10,7 @@ async function restoreImpl( ): Promise { try { if (!utils.isCacheFeatureAvailable()) { - utils.setCacheHitOutput(false); + core.setOutput(Outputs.CacheHit, "false"); return; } diff --git a/src/utils/actionUtils.ts b/src/utils/actionUtils.ts index b48d36f..6a640a5 100644 --- a/src/utils/actionUtils.ts +++ b/src/utils/actionUtils.ts @@ -1,7 +1,7 @@ import * as cache from "@actions/cache"; import * as core from "@actions/core"; -import { Outputs, RefKey } from "../constants"; +import { RefKey } from "../constants"; export function isGhes(): boolean { const ghUrl = new URL( @@ -19,10 +19,6 @@ export function isExactKeyMatch(key: string, cacheKey?: string): boolean { ); } -export function setCacheHitOutput(isCacheHit: boolean): void { - core.setOutput(Outputs.CacheHit, isCacheHit.toString()); -} - export function logWarning(message: string): void { const warningPrefix = "[warning]"; core.info(`${warningPrefix}${message}`);