mirror of
https://github.com/actions/setup-go.git
synced 2025-04-23 17:40:50 +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 primaryKey = core.getState(constants_1.State.CachePrimaryKey);
|
||||||
const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
|
const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
|
||||||
const cachePaths = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo);
|
const cachePaths = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo);
|
||||||
let pathsCounter = cachePaths.length;
|
const nonExistingPaths = cachePaths.filter(cachePath => !fs_1.default.existsSync(cachePath));
|
||||||
for (let path of cachePaths) {
|
if (nonExistingPaths.length === cachePaths.length) {
|
||||||
if (!fs_1.default.existsSync(path)) {
|
|
||||||
logWarning(`Cache folder path is retrieved but doesn't exist on disk: ${path}`);
|
|
||||||
pathsCounter--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!pathsCounter) {
|
|
||||||
throw new Error(`No cache folders exist on disk`);
|
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) {
|
if (primaryKey === state) {
|
||||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -35,19 +35,20 @@ const cachePackages = async () => {
|
||||||
|
|
||||||
const cachePaths = await getCacheDirectoryPath(packageManagerInfo);
|
const cachePaths = await getCacheDirectoryPath(packageManagerInfo);
|
||||||
|
|
||||||
let pathsCounter = cachePaths.length;
|
const nonExistingPaths = cachePaths.filter(
|
||||||
|
cachePath => !fs.existsSync(cachePath)
|
||||||
for (let path of cachePaths) {
|
|
||||||
if (!fs.existsSync(path)) {
|
|
||||||
logWarning(
|
|
||||||
`Cache folder path is retrieved but doesn't exist on disk: ${path}`
|
|
||||||
);
|
);
|
||||||
pathsCounter--;
|
|
||||||
}
|
if (nonExistingPaths.length === cachePaths.length) {
|
||||||
|
throw new Error(`No cache folders exist on disk`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pathsCounter) {
|
if (nonExistingPaths.length) {
|
||||||
throw new Error(`No cache folders exist on disk`);
|
logWarning(
|
||||||
|
`Cache folder path is retrieved but doesn't exist on disk: ${nonExistingPaths.join(
|
||||||
|
', '
|
||||||
|
)}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (primaryKey === state) {
|
if (primaryKey === state) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue