Skip to content

Commit

Permalink
add the build file
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Feb 14, 2024
1 parent 2bcf54f commit f94f332
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ const restoreCachedNpm = npmCache => {
}

const saveCachedNpm = npmCache => {
console.log('saving NPM modules')
console.log('saving NPM modules under key %s', npmCache.primaryKey)
console.log('input paths: %o', npmCache.inputPaths)

return cache
.saveCache(
npmCache.inputPaths.slice(), // Copy inputPaths, to work arround bug reported in https://github.com/actions/toolkit/pull/1378
npmCache.primaryKey
)
.saveCache(npmCache.inputPaths, npmCache.primaryKey)
.catch(err => {
// don't throw an error if cache already exists, which may happen due to
// race conditions
Expand All @@ -71,6 +69,8 @@ const saveCachedNpm = npmCache => {

// do not rethrow here or github actions will break (https://github.com/bahmutov/npm-install/issues/142)
console.warn(`saving npm cache failed with ${err}, continuing...`)
console.warn('cache key %s', npmCache.primaryKey)
console.warn('input paths %o', npmCache.inputPaths)
})
}

Expand Down Expand Up @@ -641,7 +641,8 @@ function createHttpClient() {
return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions());
}
function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) {
const components = paths;
// don't pass changes upstream
const components = paths.slice();
// Add compression method to cache version to restore
// compressed cache as per compression method
if (compressionMethod) {
Expand Down Expand Up @@ -930,26 +931,21 @@ function resolvePaths(patterns) {
implicitDescendants: false
});
try {
for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a = _g.done, !_a;) {
for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a = _g.done, !_a; _e = true) {
_c = _g.value;
_e = false;
try {
const file = _c;
const relativeFile = path
.relative(workspace, file)
.replace(new RegExp(`\\${path.sep}`, 'g'), '/');
core.debug(`Matched: ${relativeFile}`);
// Paths are made relative so the tar entries are all relative to the root of the workspace.
if (relativeFile === '') {
// path.relative returns empty string if workspace and file are equal
paths.push('.');
}
else {
paths.push(`${relativeFile}`);
}
const file = _c;
const relativeFile = path
.relative(workspace, file)
.replace(new RegExp(`\\${path.sep}`, 'g'), '/');
core.debug(`Matched: ${relativeFile}`);
// Paths are made relative so the tar entries are all relative to the root of the workspace.
if (relativeFile === '') {
// path.relative returns empty string if workspace and file are equal
paths.push('.');
}
finally {
_e = true;
else {
paths.push(`${relativeFile}`);
}
}
}
Expand Down Expand Up @@ -1033,7 +1029,10 @@ function assertDefined(name, value) {
exports.assertDefined = assertDefined;
function isGhes() {
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
const isGitHubHost = hostname === 'GITHUB.COM';
const isGheHost = hostname.endsWith('.GHE.COM') || hostname.endsWith('.GHE.LOCALHOST');
return !isGitHubHost && !isGheHost;
}
exports.isGhes = isGhes;
//# sourceMappingURL=cacheUtils.js.map
Expand All @@ -1051,20 +1050,20 @@ var CacheFilename;
(function (CacheFilename) {
CacheFilename["Gzip"] = "cache.tgz";
CacheFilename["Zstd"] = "cache.tzst";
})(CacheFilename = exports.CacheFilename || (exports.CacheFilename = {}));
})(CacheFilename || (exports.CacheFilename = CacheFilename = {}));
var CompressionMethod;
(function (CompressionMethod) {
CompressionMethod["Gzip"] = "gzip";
// Long range mode was added to zstd in v1.3.2.
// This enum is for earlier version of zstd that does not have --long support
CompressionMethod["ZstdWithoutLong"] = "zstd-without-long";
CompressionMethod["Zstd"] = "zstd";
})(CompressionMethod = exports.CompressionMethod || (exports.CompressionMethod = {}));
})(CompressionMethod || (exports.CompressionMethod = CompressionMethod = {}));
var ArchiveToolType;
(function (ArchiveToolType) {
ArchiveToolType["GNU"] = "gnu";
ArchiveToolType["BSD"] = "bsd";
})(ArchiveToolType = exports.ArchiveToolType || (exports.ArchiveToolType = {}));
})(ArchiveToolType || (exports.ArchiveToolType = ArchiveToolType = {}));
// The default number of retry attempts.
exports.DefaultRetryAttempts = 2;
// The default delay in milliseconds between retry attempts.
Expand Down

0 comments on commit f94f332

Please sign in to comment.