Add options to skip caching of folders. (#154)

Add option to skip caching the Go package directory (~/go/pkg).
Add option to skip caching the Go build directory (~/.cache/go-build).
Update README to mention new options.
This commit is contained in:
Sindre Røkenes Myren
2021-02-14 17:59:58 +01:00
committed by GitHub
parent e1ae6cf354
commit 0dd30832fc
5 changed files with 63 additions and 4 deletions

17
dist/run/index.js vendored
View File

@ -50002,7 +50002,22 @@ const getLintCacheDir = () => {
};
const getCacheDirs = () => {
// Not existing dirs are ok here: it works.
return [getLintCacheDir(), path_1.default.resolve(`${process.env.HOME}/.cache/go-build`), path_1.default.resolve(`${process.env.HOME}/go/pkg`)];
const skipPkgCache = core.getInput(`skip-pkg-cache`, { required: true }).trim();
const skipBuildCache = core.getInput(`skip-build-cache`, { required: true }).trim();
const dirs = [getLintCacheDir()];
if (skipBuildCache.toLowerCase() == "true") {
core.info(`Omitting ~/.cache/go-build from cache directories`);
}
else {
dirs.push(path_1.default.resolve(`${process.env.HOME}/.cache/go-build`));
}
if (skipPkgCache.toLowerCase() == "true") {
core.info(`Omitting ~/go/pkg from cache directories`);
}
else {
dirs.push(path_1.default.resolve(`${process.env.HOME}/go/pkg`));
}
return dirs;
};
const getIntervalKey = (invalidationIntervalDays) => {
const now = new Date();