mirror of
				https://gitea.com/actions/cache.git
				synced 2025-10-31 00:58:10 +07:00 
			
		
		
		
	Removed unused code
This commit is contained in:
		
							parent
							
								
									407044787b
								
							
						
					
					
						commit
						1ddc49105d
					
				| @ -66,13 +66,13 @@ test("restore without AC available should no-op", async () => { | |||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     const restoreCacheMock = jest.spyOn(cache, "restoreCache"); |     const restoreCacheMock = jest.spyOn(cache, "restoreCache"); | ||||||
|     const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput"); |     const setCacheHitOutputMock = jest.spyOn(core, "setOutput"); | ||||||
| 
 | 
 | ||||||
|     await run(new StateProvider()); |     await run(new StateProvider()); | ||||||
| 
 | 
 | ||||||
|     expect(restoreCacheMock).toHaveBeenCalledTimes(0); |     expect(restoreCacheMock).toHaveBeenCalledTimes(0); | ||||||
|     expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1); |     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 () => { | 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 restoreCacheMock = jest.spyOn(cache, "restoreCache"); | ||||||
|     const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput"); |     const setCacheHitOutputMock = jest.spyOn(core, "setOutput"); | ||||||
| 
 | 
 | ||||||
|     await run(new StateProvider()); |     await run(new StateProvider()); | ||||||
| 
 | 
 | ||||||
|     expect(restoreCacheMock).toHaveBeenCalledTimes(0); |     expect(restoreCacheMock).toHaveBeenCalledTimes(0); | ||||||
|     expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1); |     expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1); | ||||||
|     expect(setCacheHitOutputMock).toHaveBeenCalledWith(false); |     expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "false"); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| test("restore on GHES with AC available ", async () => { | test("restore on GHES with AC available ", async () => { | ||||||
|  | |||||||
							
								
								
									
										8
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							| @ -10045,7 +10045,7 @@ var __importStar = (this && this.__importStar) || function (mod) { | |||||||
|     return result; |     return result; | ||||||
| }; | }; | ||||||
| Object.defineProperty(exports, "__esModule", { value: true }); | 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 cache = __importStar(__webpack_require__(692)); | ||||||
| const core = __importStar(__webpack_require__(470)); | const core = __importStar(__webpack_require__(470)); | ||||||
| const constants_1 = __webpack_require__(196); | const constants_1 = __webpack_require__(196); | ||||||
| @ -10061,10 +10061,6 @@ function isExactKeyMatch(key, cacheKey) { | |||||||
|         }) === 0); |         }) === 0); | ||||||
| } | } | ||||||
| exports.isExactKeyMatch = isExactKeyMatch; | exports.isExactKeyMatch = isExactKeyMatch; | ||||||
| function setCacheHitOutput(isCacheHit) { |  | ||||||
|     core.setOutput(constants_1.Outputs.CacheHit, isCacheHit.toString()); |  | ||||||
| } |  | ||||||
| exports.setCacheHitOutput = setCacheHitOutput; |  | ||||||
| function logWarning(message) { | function logWarning(message) { | ||||||
|     const warningPrefix = "[warning]"; |     const warningPrefix = "[warning]"; | ||||||
|     core.info(`${warningPrefix}${message}`); |     core.info(`${warningPrefix}${message}`); | ||||||
| @ -50459,7 +50455,7 @@ function restoreImpl(stateProvider) { | |||||||
|     return __awaiter(this, void 0, void 0, function* () { |     return __awaiter(this, void 0, void 0, function* () { | ||||||
|         try { |         try { | ||||||
|             if (!utils.isCacheFeatureAvailable()) { |             if (!utils.isCacheFeatureAvailable()) { | ||||||
|                 utils.setCacheHitOutput(false); |                 core.setOutput(constants_1.Outputs.CacheHit, "false"); | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|             // Validate inputs, this can cause task failure
 |             // Validate inputs, this can cause task failure
 | ||||||
|  | |||||||
							
								
								
									
										8
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							| @ -38565,7 +38565,7 @@ var __importStar = (this && this.__importStar) || function (mod) { | |||||||
|     return result; |     return result; | ||||||
| }; | }; | ||||||
| Object.defineProperty(exports, "__esModule", { value: true }); | 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 cache = __importStar(__webpack_require__(692)); | ||||||
| const core = __importStar(__webpack_require__(470)); | const core = __importStar(__webpack_require__(470)); | ||||||
| const constants_1 = __webpack_require__(196); | const constants_1 = __webpack_require__(196); | ||||||
| @ -38581,10 +38581,6 @@ function isExactKeyMatch(key, cacheKey) { | |||||||
|         }) === 0); |         }) === 0); | ||||||
| } | } | ||||||
| exports.isExactKeyMatch = isExactKeyMatch; | exports.isExactKeyMatch = isExactKeyMatch; | ||||||
| function setCacheHitOutput(isCacheHit) { |  | ||||||
|     core.setOutput(constants_1.Outputs.CacheHit, isCacheHit.toString()); |  | ||||||
| } |  | ||||||
| exports.setCacheHitOutput = setCacheHitOutput; |  | ||||||
| function logWarning(message) { | function logWarning(message) { | ||||||
|     const warningPrefix = "[warning]"; |     const warningPrefix = "[warning]"; | ||||||
|     core.info(`${warningPrefix}${message}`); |     core.info(`${warningPrefix}${message}`); | ||||||
| @ -50459,7 +50455,7 @@ function restoreImpl(stateProvider) { | |||||||
|     return __awaiter(this, void 0, void 0, function* () { |     return __awaiter(this, void 0, void 0, function* () { | ||||||
|         try { |         try { | ||||||
|             if (!utils.isCacheFeatureAvailable()) { |             if (!utils.isCacheFeatureAvailable()) { | ||||||
|                 utils.setCacheHitOutput(false); |                 core.setOutput(constants_1.Outputs.CacheHit, "false"); | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|             // Validate inputs, this can cause task failure
 |             // Validate inputs, this can cause task failure
 | ||||||
|  | |||||||
							
								
								
									
										6
									
								
								dist/save-only/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								dist/save-only/index.js
									
									
									
									
										vendored
									
									
								
							| @ -38589,7 +38589,7 @@ var __importStar = (this && this.__importStar) || function (mod) { | |||||||
|     return result; |     return result; | ||||||
| }; | }; | ||||||
| Object.defineProperty(exports, "__esModule", { value: true }); | 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 cache = __importStar(__webpack_require__(692)); | ||||||
| const core = __importStar(__webpack_require__(470)); | const core = __importStar(__webpack_require__(470)); | ||||||
| const constants_1 = __webpack_require__(196); | const constants_1 = __webpack_require__(196); | ||||||
| @ -38605,10 +38605,6 @@ function isExactKeyMatch(key, cacheKey) { | |||||||
|         }) === 0); |         }) === 0); | ||||||
| } | } | ||||||
| exports.isExactKeyMatch = isExactKeyMatch; | exports.isExactKeyMatch = isExactKeyMatch; | ||||||
| function setCacheHitOutput(isCacheHit) { |  | ||||||
|     core.setOutput(constants_1.Outputs.CacheHit, isCacheHit.toString()); |  | ||||||
| } |  | ||||||
| exports.setCacheHitOutput = setCacheHitOutput; |  | ||||||
| function logWarning(message) { | function logWarning(message) { | ||||||
|     const warningPrefix = "[warning]"; |     const warningPrefix = "[warning]"; | ||||||
|     core.info(`${warningPrefix}${message}`); |     core.info(`${warningPrefix}${message}`); | ||||||
|  | |||||||
							
								
								
									
										6
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							| @ -38560,7 +38560,7 @@ var __importStar = (this && this.__importStar) || function (mod) { | |||||||
|     return result; |     return result; | ||||||
| }; | }; | ||||||
| Object.defineProperty(exports, "__esModule", { value: true }); | 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 cache = __importStar(__webpack_require__(692)); | ||||||
| const core = __importStar(__webpack_require__(470)); | const core = __importStar(__webpack_require__(470)); | ||||||
| const constants_1 = __webpack_require__(196); | const constants_1 = __webpack_require__(196); | ||||||
| @ -38576,10 +38576,6 @@ function isExactKeyMatch(key, cacheKey) { | |||||||
|         }) === 0); |         }) === 0); | ||||||
| } | } | ||||||
| exports.isExactKeyMatch = isExactKeyMatch; | exports.isExactKeyMatch = isExactKeyMatch; | ||||||
| function setCacheHitOutput(isCacheHit) { |  | ||||||
|     core.setOutput(constants_1.Outputs.CacheHit, isCacheHit.toString()); |  | ||||||
| } |  | ||||||
| exports.setCacheHitOutput = setCacheHitOutput; |  | ||||||
| function logWarning(message) { | function logWarning(message) { | ||||||
|     const warningPrefix = "[warning]"; |     const warningPrefix = "[warning]"; | ||||||
|     core.info(`${warningPrefix}${message}`); |     core.info(`${warningPrefix}${message}`); | ||||||
|  | |||||||
| @ -10,7 +10,7 @@ async function restoreImpl( | |||||||
| ): Promise<string | undefined> { | ): Promise<string | undefined> { | ||||||
|     try { |     try { | ||||||
|         if (!utils.isCacheFeatureAvailable()) { |         if (!utils.isCacheFeatureAvailable()) { | ||||||
|             utils.setCacheHitOutput(false); |             core.setOutput(Outputs.CacheHit, "false"); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| import * as cache from "@actions/cache"; | import * as cache from "@actions/cache"; | ||||||
| import * as core from "@actions/core"; | import * as core from "@actions/core"; | ||||||
| 
 | 
 | ||||||
| import { Outputs, RefKey } from "../constants"; | import { RefKey } from "../constants"; | ||||||
| 
 | 
 | ||||||
| export function isGhes(): boolean { | export function isGhes(): boolean { | ||||||
|     const ghUrl = new URL( |     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 { | export function logWarning(message: string): void { | ||||||
|     const warningPrefix = "[warning]"; |     const warningPrefix = "[warning]"; | ||||||
|     core.info(`${warningPrefix}${message}`); |     core.info(`${warningPrefix}${message}`); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user