Merge pull request #264 from e-korolevskii/258-not-throw-err-no-cache-folders
Not throw err no cache folder
This commit is contained in:
		
						commit
						30b9ddff11
					
				| @ -295,7 +295,6 @@ describe('setup-go', () => { | |||||||
|     findSpy.mockImplementation(() => toolPath); |     findSpy.mockImplementation(() => toolPath); | ||||||
|     await main.run(); |     await main.run(); | ||||||
| 
 | 
 | ||||||
|     let expPath = path.join(toolPath, 'bin'); |  | ||||||
|     expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); |     expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
| @ -462,9 +461,6 @@ describe('setup-go', () => { | |||||||
|     inputs['go-version'] = versionSpec; |     inputs['go-version'] = versionSpec; | ||||||
|     inputs['token'] = 'faketoken'; |     inputs['token'] = 'faketoken'; | ||||||
| 
 | 
 | ||||||
|     let expectedUrl = |  | ||||||
|       'https://github.com/actions/go-versions/releases/download/1.12.14-20200616.18/go-1.12.14-linux-x64.tar.gz'; |  | ||||||
| 
 |  | ||||||
|     // ... but not in the local cache
 |     // ... but not in the local cache
 | ||||||
|     findSpy.mockImplementation(() => ''); |     findSpy.mockImplementation(() => ''); | ||||||
| 
 | 
 | ||||||
| @ -526,7 +522,7 @@ describe('setup-go', () => { | |||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     mkdirpSpy.mockImplementation(async () => {}); |     mkdirpSpy.mockImplementation(async () => {}); | ||||||
|     existsSpy.mockImplementation(path => { |     existsSpy.mockImplementation(() => { | ||||||
|       return false; |       return false; | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
| @ -707,8 +703,6 @@ describe('setup-go', () => { | |||||||
|       const toolPath = path.normalize('/cache/go/1.17.5/x64'); |       const toolPath = path.normalize('/cache/go/1.17.5/x64'); | ||||||
|       extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); |       extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); | ||||||
|       cacheSpy.mockImplementation(async () => toolPath); |       cacheSpy.mockImplementation(async () => toolPath); | ||||||
|       const expectedUrl = |  | ||||||
|         'https://github.com/actions/go-versions/releases/download/1.17.6-1668090892/go-1.17.6-darwin-x64.tar.gz'; |  | ||||||
| 
 | 
 | ||||||
|       await main.run(); |       await main.run(); | ||||||
| 
 | 
 | ||||||
| @ -834,7 +828,7 @@ exclude example.com/thismodule v1.3.0 | |||||||
| 
 | 
 | ||||||
|     it('reads version from go.mod', async () => { |     it('reads version from go.mod', async () => { | ||||||
|       inputs['go-version-file'] = 'go.mod'; |       inputs['go-version-file'] = 'go.mod'; | ||||||
|       existsSpy.mockImplementation(path => true); |       existsSpy.mockImplementation(() => true); | ||||||
|       readFileSpy.mockImplementation(() => Buffer.from(goModContents)); |       readFileSpy.mockImplementation(() => Buffer.from(goModContents)); | ||||||
| 
 | 
 | ||||||
|       await main.run(); |       await main.run(); | ||||||
| @ -846,7 +840,7 @@ exclude example.com/thismodule v1.3.0 | |||||||
| 
 | 
 | ||||||
|     it('reads version from .go-version', async () => { |     it('reads version from .go-version', async () => { | ||||||
|       inputs['go-version-file'] = '.go-version'; |       inputs['go-version-file'] = '.go-version'; | ||||||
|       existsSpy.mockImplementation(path => true); |       existsSpy.mockImplementation(() => true); | ||||||
|       readFileSpy.mockImplementation(() => Buffer.from(`1.13.0${osm.EOL}`)); |       readFileSpy.mockImplementation(() => Buffer.from(`1.13.0${osm.EOL}`)); | ||||||
| 
 | 
 | ||||||
|       await main.run(); |       await main.run(); | ||||||
| @ -859,7 +853,7 @@ exclude example.com/thismodule v1.3.0 | |||||||
|     it('is overwritten by go-version', async () => { |     it('is overwritten by go-version', async () => { | ||||||
|       inputs['go-version'] = '1.13.1'; |       inputs['go-version'] = '1.13.1'; | ||||||
|       inputs['go-version-file'] = 'go.mod'; |       inputs['go-version-file'] = 'go.mod'; | ||||||
|       existsSpy.mockImplementation(path => true); |       existsSpy.mockImplementation(() => true); | ||||||
|       readFileSpy.mockImplementation(() => Buffer.from(goModContents)); |       readFileSpy.mockImplementation(() => Buffer.from(goModContents)); | ||||||
| 
 | 
 | ||||||
|       await main.run(); |       await main.run(); | ||||||
| @ -871,7 +865,7 @@ exclude example.com/thismodule v1.3.0 | |||||||
| 
 | 
 | ||||||
|     it('reports a read failure', async () => { |     it('reports a read failure', async () => { | ||||||
|       inputs['go-version-file'] = 'go.mod'; |       inputs['go-version-file'] = 'go.mod'; | ||||||
|       existsSpy.mockImplementation(path => false); |       existsSpy.mockImplementation(() => false); | ||||||
| 
 | 
 | ||||||
|       await main.run(); |       await main.run(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										385
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										385
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							| @ -59932,96 +59932,103 @@ module.exports = v4; | |||||||
| /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||||||
| 
 | 
 | ||||||
| "use strict"; | "use strict"; | ||||||
| 
 | 
 | ||||||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||||||
|     if (k2 === undefined) k2 = k; |     if (k2 === undefined) k2 = k; | ||||||
|     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); |     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||||||
| }) : (function(o, m, k, k2) { | }) : (function(o, m, k, k2) { | ||||||
|     if (k2 === undefined) k2 = k; |     if (k2 === undefined) k2 = k; | ||||||
|     o[k2] = m[k]; |     o[k2] = m[k]; | ||||||
| })); | })); | ||||||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||||||
|     Object.defineProperty(o, "default", { enumerable: true, value: v }); |     Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||||||
| }) : function(o, v) { | }) : function(o, v) { | ||||||
|     o["default"] = v; |     o["default"] = v; | ||||||
| }); | }); | ||||||
| var __importStar = (this && this.__importStar) || function (mod) { | var __importStar = (this && this.__importStar) || function (mod) { | ||||||
|     if (mod && mod.__esModule) return mod; |     if (mod && mod.__esModule) return mod; | ||||||
|     var result = {}; |     var result = {}; | ||||||
|     if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); |     if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||||||
|     __setModuleDefault(result, mod); |     __setModuleDefault(result, mod); | ||||||
|     return result; |     return result; | ||||||
| }; | }; | ||||||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||||||
|     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||||||
|     return new (P || (P = Promise))(function (resolve, reject) { |     return new (P || (P = Promise))(function (resolve, reject) { | ||||||
|         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } |         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||||||
|         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } |         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||||||
|         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } |         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||||||
|         step((generator = generator.apply(thisArg, _arguments || [])).next()); |         step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||||||
|     }); |     }); | ||||||
| }; | }; | ||||||
| var __importDefault = (this && this.__importDefault) || function (mod) { | var __importDefault = (this && this.__importDefault) || function (mod) { | ||||||
|     return (mod && mod.__esModule) ? mod : { "default": mod }; |     return (mod && mod.__esModule) ? mod : { "default": mod }; | ||||||
| }; | }; | ||||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||||
| exports.logWarning = exports.run = void 0; | exports.run = void 0; | ||||||
| const core = __importStar(__nccwpck_require__(2186)); | const core = __importStar(__nccwpck_require__(2186)); | ||||||
| const cache = __importStar(__nccwpck_require__(7799)); | const cache = __importStar(__nccwpck_require__(7799)); | ||||||
| const fs_1 = __importDefault(__nccwpck_require__(7147)); | const fs_1 = __importDefault(__nccwpck_require__(7147)); | ||||||
| const constants_1 = __nccwpck_require__(9042); | const constants_1 = __nccwpck_require__(9042); | ||||||
| const cache_utils_1 = __nccwpck_require__(1678); | const cache_utils_1 = __nccwpck_require__(1678); | ||||||
| // Catch and log any unhandled exceptions.  These exceptions can leak out of the uploadChunk method in
 | // Catch and log any unhandled exceptions.  These exceptions can leak out of the uploadChunk method in
 | ||||||
| // @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
 | // @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
 | ||||||
| // throw an uncaught exception.  Instead of failing this action, just warn.
 | // throw an uncaught exception.  Instead of failing this action, just warn.
 | ||||||
| process.on('uncaughtException', e => { | process.on('uncaughtException', e => { | ||||||
|     const warningPrefix = '[warning]'; |     const warningPrefix = '[warning]'; | ||||||
|     core.info(`${warningPrefix}${e.message}`); |     core.info(`${warningPrefix}${e.message}`); | ||||||
| }); | }); | ||||||
| function run() { | function run() { | ||||||
|     return __awaiter(this, void 0, void 0, function* () { |     return __awaiter(this, void 0, void 0, function* () { | ||||||
|         try { |         try { | ||||||
|             yield cachePackages(); |             yield cachePackages(); | ||||||
|         } |         } | ||||||
|         catch (error) { |         catch (error) { | ||||||
|             core.setFailed(error.message); |             let message = 'Unknown error!'; | ||||||
|         } |             if (error instanceof Error) { | ||||||
|     }); |                 message = error.message; | ||||||
| } |             } | ||||||
| exports.run = run; |             if (typeof error === 'string') { | ||||||
| const cachePackages = () => __awaiter(void 0, void 0, void 0, function* () { |                 message = error; | ||||||
|     const cacheInput = core.getBooleanInput('cache'); |             } | ||||||
|     if (!cacheInput) { |             core.setFailed(message); | ||||||
|         return; |         } | ||||||
|     } |     }); | ||||||
|     const packageManager = 'default'; | } | ||||||
|     const state = core.getState(constants_1.State.CacheMatchedKey); | exports.run = run; | ||||||
|     const primaryKey = core.getState(constants_1.State.CachePrimaryKey); | const cachePackages = () => __awaiter(void 0, void 0, void 0, function* () { | ||||||
|     const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager); |     const cacheInput = core.getBooleanInput('cache'); | ||||||
|     const cachePaths = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo); |     if (!cacheInput) { | ||||||
|     const nonExistingPaths = cachePaths.filter(cachePath => !fs_1.default.existsSync(cachePath)); |         return; | ||||||
|     if (nonExistingPaths.length === cachePaths.length) { |     } | ||||||
|         throw new Error(`There are no cache folders on the disk`); |     const packageManager = 'default'; | ||||||
|     } |     const state = core.getState(constants_1.State.CacheMatchedKey); | ||||||
|     if (nonExistingPaths.length) { |     const primaryKey = core.getState(constants_1.State.CachePrimaryKey); | ||||||
|         logWarning(`Cache folder path is retrieved but doesn't exist on disk: ${nonExistingPaths.join(', ')}`); |     const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager); | ||||||
|     } |     const cachePaths = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo); | ||||||
|     if (primaryKey === state) { |     const nonExistingPaths = cachePaths.filter(cachePath => !fs_1.default.existsSync(cachePath)); | ||||||
|         core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); |     if (nonExistingPaths.length === cachePaths.length) { | ||||||
|         return; |         core.warning('There are no cache folders on the disk'); | ||||||
|     } |         return; | ||||||
|     const cacheId = yield cache.saveCache(cachePaths, primaryKey); |     } | ||||||
|     if (cacheId === -1) { |     if (nonExistingPaths.length) { | ||||||
|         return; |         logWarning(`Cache folder path is retrieved but doesn't exist on disk: ${nonExistingPaths.join(', ')}`); | ||||||
|     } |     } | ||||||
|     core.info(`Cache saved with the key: ${primaryKey}`); |     if (primaryKey === state) { | ||||||
| }); |         core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); | ||||||
| function logWarning(message) { |         return; | ||||||
|     const warningPrefix = '[warning]'; |     } | ||||||
|     core.info(`${warningPrefix}${message}`); |     const cacheId = yield cache.saveCache(cachePaths, primaryKey); | ||||||
| } |     if (cacheId === -1) { | ||||||
| exports.logWarning = logWarning; |         return; | ||||||
| run(); |     } | ||||||
|  |     core.info(`Cache saved with the key: ${primaryKey}`); | ||||||
|  | }); | ||||||
|  | function logWarning(message) { | ||||||
|  |     const warningPrefix = '[warning]'; | ||||||
|  |     core.info(`${warningPrefix}${message}`); | ||||||
|  | } | ||||||
|  | run(); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /***/ }), | /***/ }), | ||||||
| @ -60030,84 +60037,84 @@ run(); | |||||||
| /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||||||
| 
 | 
 | ||||||
| "use strict"; | "use strict"; | ||||||
| 
 | 
 | ||||||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||||||
|     if (k2 === undefined) k2 = k; |     if (k2 === undefined) k2 = k; | ||||||
|     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); |     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||||||
| }) : (function(o, m, k, k2) { | }) : (function(o, m, k, k2) { | ||||||
|     if (k2 === undefined) k2 = k; |     if (k2 === undefined) k2 = k; | ||||||
|     o[k2] = m[k]; |     o[k2] = m[k]; | ||||||
| })); | })); | ||||||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||||||
|     Object.defineProperty(o, "default", { enumerable: true, value: v }); |     Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||||||
| }) : function(o, v) { | }) : function(o, v) { | ||||||
|     o["default"] = v; |     o["default"] = v; | ||||||
| }); | }); | ||||||
| var __importStar = (this && this.__importStar) || function (mod) { | var __importStar = (this && this.__importStar) || function (mod) { | ||||||
|     if (mod && mod.__esModule) return mod; |     if (mod && mod.__esModule) return mod; | ||||||
|     var result = {}; |     var result = {}; | ||||||
|     if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); |     if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||||||
|     __setModuleDefault(result, mod); |     __setModuleDefault(result, mod); | ||||||
|     return result; |     return result; | ||||||
| }; | }; | ||||||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||||||
|     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||||||
|     return new (P || (P = Promise))(function (resolve, reject) { |     return new (P || (P = Promise))(function (resolve, reject) { | ||||||
|         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } |         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||||||
|         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } |         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||||||
|         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } |         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||||||
|         step((generator = generator.apply(thisArg, _arguments || [])).next()); |         step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||||||
|     }); |     }); | ||||||
| }; | }; | ||||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||||
| exports.isCacheFeatureAvailable = exports.isGhes = exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getCommandOutput = void 0; | exports.isCacheFeatureAvailable = exports.isGhes = exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getCommandOutput = void 0; | ||||||
| const cache = __importStar(__nccwpck_require__(7799)); | const cache = __importStar(__nccwpck_require__(7799)); | ||||||
| const core = __importStar(__nccwpck_require__(2186)); | const core = __importStar(__nccwpck_require__(2186)); | ||||||
| const exec = __importStar(__nccwpck_require__(1514)); | const exec = __importStar(__nccwpck_require__(1514)); | ||||||
| const package_managers_1 = __nccwpck_require__(6663); | const package_managers_1 = __nccwpck_require__(6663); | ||||||
| exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () { | exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () { | ||||||
|     let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true }); |     let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true }); | ||||||
|     if (exitCode) { |     if (exitCode) { | ||||||
|         stderr = !stderr.trim() |         stderr = !stderr.trim() | ||||||
|             ? `The '${toolCommand}' command failed with exit code: ${exitCode}` |             ? `The '${toolCommand}' command failed with exit code: ${exitCode}` | ||||||
|             : stderr; |             : stderr; | ||||||
|         throw new Error(stderr); |         throw new Error(stderr); | ||||||
|     } |     } | ||||||
|     return stdout.trim(); |     return stdout.trim(); | ||||||
| }); | }); | ||||||
| exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () { | exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () { | ||||||
|     if (!package_managers_1.supportedPackageManagers[packageManager]) { |     if (!package_managers_1.supportedPackageManagers[packageManager]) { | ||||||
|         throw new Error(`It's not possible to use ${packageManager}, please, check correctness of the package manager name spelling.`); |         throw new Error(`It's not possible to use ${packageManager}, please, check correctness of the package manager name spelling.`); | ||||||
|     } |     } | ||||||
|     const obtainedPackageManager = package_managers_1.supportedPackageManagers[packageManager]; |     const obtainedPackageManager = package_managers_1.supportedPackageManagers[packageManager]; | ||||||
|     return obtainedPackageManager; |     return obtainedPackageManager; | ||||||
| }); | }); | ||||||
| exports.getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () { | exports.getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () { | ||||||
|     let pathList = yield Promise.all(packageManagerInfo.cacheFolderCommandList.map(command => exports.getCommandOutput(command))); |     let pathList = yield Promise.all(packageManagerInfo.cacheFolderCommandList.map(command => exports.getCommandOutput(command))); | ||||||
|     const emptyPaths = pathList.filter(item => !item); |     const emptyPaths = pathList.filter(item => !item); | ||||||
|     if (emptyPaths.length) { |     if (emptyPaths.length) { | ||||||
|         throw new Error(`Could not get cache folder paths.`); |         throw new Error(`Could not get cache folder paths.`); | ||||||
|     } |     } | ||||||
|     return pathList; |     return pathList; | ||||||
| }); | }); | ||||||
| function isGhes() { | function isGhes() { | ||||||
|     const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); |     const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); | ||||||
|     return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; |     return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; | ||||||
| } | } | ||||||
| exports.isGhes = isGhes; | exports.isGhes = isGhes; | ||||||
| function isCacheFeatureAvailable() { | function isCacheFeatureAvailable() { | ||||||
|     if (!cache.isFeatureAvailable()) { |     if (!cache.isFeatureAvailable()) { | ||||||
|         if (isGhes()) { |         if (isGhes()) { | ||||||
|             throw new Error('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'); |             throw new Error('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'); | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             core.warning('The runner was not able to contact the cache service. Caching will be skipped'); |             core.warning('The runner was not able to contact the cache service. Caching will be skipped'); | ||||||
|         } |         } | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| exports.isCacheFeatureAvailable = isCacheFeatureAvailable; | exports.isCacheFeatureAvailable = isCacheFeatureAvailable; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /***/ }), | /***/ }), | ||||||
| @ -60116,18 +60123,18 @@ exports.isCacheFeatureAvailable = isCacheFeatureAvailable; | |||||||
| /***/ ((__unused_webpack_module, exports) => { | /***/ ((__unused_webpack_module, exports) => { | ||||||
| 
 | 
 | ||||||
| "use strict"; | "use strict"; | ||||||
| 
 | 
 | ||||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||||
| exports.Outputs = exports.State = void 0; | exports.Outputs = exports.State = void 0; | ||||||
| var State; | var State; | ||||||
| (function (State) { | (function (State) { | ||||||
|     State["CachePrimaryKey"] = "CACHE_KEY"; |     State["CachePrimaryKey"] = "CACHE_KEY"; | ||||||
|     State["CacheMatchedKey"] = "CACHE_RESULT"; |     State["CacheMatchedKey"] = "CACHE_RESULT"; | ||||||
| })(State = exports.State || (exports.State = {})); | })(State = exports.State || (exports.State = {})); | ||||||
| var Outputs; | var Outputs; | ||||||
| (function (Outputs) { | (function (Outputs) { | ||||||
|     Outputs["CacheHit"] = "cache-hit"; |     Outputs["CacheHit"] = "cache-hit"; | ||||||
| })(Outputs = exports.Outputs || (exports.Outputs = {})); | })(Outputs = exports.Outputs || (exports.Outputs = {})); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /***/ }), | /***/ }), | ||||||
| @ -60136,15 +60143,15 @@ var Outputs; | |||||||
| /***/ ((__unused_webpack_module, exports) => { | /***/ ((__unused_webpack_module, exports) => { | ||||||
| 
 | 
 | ||||||
| "use strict"; | "use strict"; | ||||||
| 
 | 
 | ||||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||||
| exports.supportedPackageManagers = void 0; | exports.supportedPackageManagers = void 0; | ||||||
| exports.supportedPackageManagers = { | exports.supportedPackageManagers = { | ||||||
|     default: { |     default: { | ||||||
|         dependencyFilePattern: 'go.sum', |         dependencyFilePattern: 'go.sum', | ||||||
|         cacheFolderCommandList: ['go env GOMODCACHE', 'go env GOCACHE'] |         cacheFolderCommandList: ['go env GOMODCACHE', 'go env GOCACHE'] | ||||||
|     } |     } | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /***/ }), | /***/ }), | ||||||
|  | |||||||
							
								
								
									
										1282
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1282
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -16,7 +16,14 @@ export async function run() { | |||||||
|   try { |   try { | ||||||
|     await cachePackages(); |     await cachePackages(); | ||||||
|   } catch (error) { |   } catch (error) { | ||||||
|     core.setFailed(error.message); |     let message = 'Unknown error!'; | ||||||
|  |     if (error instanceof Error) { | ||||||
|  |       message = error.message; | ||||||
|  |     } | ||||||
|  |     if (typeof error === 'string') { | ||||||
|  |       message = error; | ||||||
|  |     } | ||||||
|  |     core.setFailed(message); | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -40,7 +47,8 @@ const cachePackages = async () => { | |||||||
|   ); |   ); | ||||||
| 
 | 
 | ||||||
|   if (nonExistingPaths.length === cachePaths.length) { |   if (nonExistingPaths.length === cachePaths.length) { | ||||||
|     throw new Error(`There are no cache folders on the disk`); |     core.warning('There are no cache folders on the disk'); | ||||||
|  |     return; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   if (nonExistingPaths.length) { |   if (nonExistingPaths.length) { | ||||||
| @ -65,7 +73,7 @@ const cachePackages = async () => { | |||||||
|   core.info(`Cache saved with the key: ${primaryKey}`); |   core.info(`Cache saved with the key: ${primaryKey}`); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| export function logWarning(message: string): void { | 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