1
0
Fork 0
mirror of https://github.com/actions/setup-go synced 2024-12-23 06:42:41 +00:00

lint and build

Signed-off-by: Anton Troshin <anton@diagrid.io>
This commit is contained in:
Anton Troshin 2024-11-19 16:21:45 -06:00
parent c8eefa5dde
commit f8cf508b5f
No known key found for this signature in database
GPG key ID: 9F8A96ACA9EB6363

16
dist/setup/index.js vendored
View file

@ -88401,6 +88401,7 @@ function cacheWindowsDir(extPath, tool, version, arch) {
// iterate through actual cache directory paths and make links if necessary // iterate through actual cache directory paths and make links if necessary
for (const cachePath of actualCacheDirectoryPaths) { for (const cachePath of actualCacheDirectoryPaths) {
core.info(`Trying to link ${cachePath.defaultPath} to ${cachePath.actualPath}`); core.info(`Trying to link ${cachePath.defaultPath} to ${cachePath.actualPath}`);
try {
if (!fs_1.default.existsSync(cachePath.actualPath)) { if (!fs_1.default.existsSync(cachePath.actualPath)) {
core.info(`Creating directory ${cachePath.actualPath}`); core.info(`Creating directory ${cachePath.actualPath}`);
fs_1.default.mkdirSync(path.dirname(cachePath.actualPath), { recursive: true }); fs_1.default.mkdirSync(path.dirname(cachePath.actualPath), { recursive: true });
@ -88408,17 +88409,22 @@ function cacheWindowsDir(extPath, tool, version, arch) {
else { else {
core.info(`Directory ${cachePath.actualPath} already exists`); core.info(`Directory ${cachePath.actualPath} already exists`);
} }
// make sure the link is pointing to the actual cache directory // check if the default path is a symlink
const symlinkTarget = fs_1.default.readlinkSync(cachePath.defaultPath); const isSymlink = fs_1.default.lstatSync(cachePath.defaultPath).isSymbolicLink();
core.info(`Symlink target: ${symlinkTarget}`); if (isSymlink) {
if (symlinkTarget !== "") { core.info(`Default path is symlink ${cachePath.defaultPath} => ${fs_1.default.readlinkSync(cachePath.defaultPath)}`);
core.info(`Found link ${cachePath.defaultPath} => ${symlinkTarget}`);
} }
else { else {
core.info(`Default path is not a symlink ${cachePath.defaultPath}`);
fs_1.default.symlinkSync(cachePath.actualPath, cachePath.defaultPath, 'junction'); fs_1.default.symlinkSync(cachePath.actualPath, cachePath.defaultPath, 'junction');
core.info(`Created link ${cachePath.defaultPath} => ${cachePath.actualPath}`); core.info(`Created link ${cachePath.defaultPath} => ${cachePath.actualPath}`);
} }
} }
catch (err) {
core.info(`Failed to link ${cachePath.defaultPath} to ${cachePath.actualPath}`);
core.info('Error: ' + err);
}
}
// make outer code to continue using toolcache as if it were installed on c: // make outer code to continue using toolcache as if it were installed on c:
// restore toolcache root to default drive c: // restore toolcache root to default drive c:
process.env['RUNNER_TOOL_CACHE'] = defaultToolCacheRoot; process.env['RUNNER_TOOL_CACHE'] = defaultToolCacheRoot;