mirror of
https://github.com/actions/setup-go.git
synced 2025-04-24 09:52:15 +00:00
Fix review points
This commit is contained in:
parent
832658fa34
commit
ede5159e42
2 changed files with 16 additions and 18 deletions
13
dist/cache-save/index.js
vendored
13
dist/cache-save/index.js
vendored
|
@ -49203,16 +49203,13 @@ const cachePackages = () => __awaiter(void 0, void 0, void 0, function* () {
|
|||
const primaryKey = core.getState(constants_1.State.CachePrimaryKey);
|
||||
const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
|
||||
const cachePaths = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo);
|
||||
let pathsCounter = cachePaths.length;
|
||||
for (let path of cachePaths) {
|
||||
if (!fs_1.default.existsSync(path)) {
|
||||
logWarning(`Cache folder path is retrieved but doesn't exist on disk: ${path}`);
|
||||
pathsCounter--;
|
||||
}
|
||||
}
|
||||
if (!pathsCounter) {
|
||||
const nonExistingPaths = cachePaths.filter(cachePath => !fs_1.default.existsSync(cachePath));
|
||||
if (nonExistingPaths.length === cachePaths.length) {
|
||||
throw new Error(`No cache folders exist on disk`);
|
||||
}
|
||||
if (nonExistingPaths.length) {
|
||||
logWarning(`Cache folder path is retrieved but doesn't exist on disk: ${nonExistingPaths.join(', ')}`);
|
||||
}
|
||||
if (primaryKey === state) {
|
||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||
return;
|
||||
|
|
|
@ -35,19 +35,20 @@ const cachePackages = async () => {
|
|||
|
||||
const cachePaths = await getCacheDirectoryPath(packageManagerInfo);
|
||||
|
||||
let pathsCounter = cachePaths.length;
|
||||
|
||||
for (let path of cachePaths) {
|
||||
if (!fs.existsSync(path)) {
|
||||
logWarning(
|
||||
`Cache folder path is retrieved but doesn't exist on disk: ${path}`
|
||||
const nonExistingPaths = cachePaths.filter(
|
||||
cachePath => !fs.existsSync(cachePath)
|
||||
);
|
||||
pathsCounter--;
|
||||
}
|
||||
|
||||
if (nonExistingPaths.length === cachePaths.length) {
|
||||
throw new Error(`No cache folders exist on disk`);
|
||||
}
|
||||
|
||||
if (!pathsCounter) {
|
||||
throw new Error(`No cache folders exist on disk`);
|
||||
if (nonExistingPaths.length) {
|
||||
logWarning(
|
||||
`Cache folder path is retrieved but doesn't exist on disk: ${nonExistingPaths.join(
|
||||
', '
|
||||
)}`
|
||||
);
|
||||
}
|
||||
|
||||
if (primaryKey === state) {
|
||||
|
|
Loading…
Add table
Reference in a new issue