New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@actions/cache

Package Overview
Dependencies
Maintainers
5
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@actions/cache - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

0

lib/cache.d.ts

@@ -0,0 +0,0 @@ import { DownloadOptions, UploadOptions } from './options';

7

lib/cache.js

@@ -90,5 +90,9 @@ "use strict";

yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options);
if (core.isDebug()) {
yield tar_1.listTar(archivePath, compressionMethod);
}
const archiveFileSize = utils.getArchiveFileSizeIsBytes(archivePath);
core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
yield tar_1.extractTar(archivePath, compressionMethod);
core.info('Cache restored successfully');
}

@@ -136,2 +140,5 @@ finally {

yield tar_1.createTar(archiveFolder, cachePaths, compressionMethod);
if (core.isDebug()) {
yield tar_1.listTar(archivePath, compressionMethod);
}
const fileSizeLimit = 5 * 1024 * 1024 * 1024; // 5GB per repo limit

@@ -138,0 +145,0 @@ const archiveFileSize = utils.getArchiveFileSizeIsBytes(archivePath);

@@ -0,0 +0,0 @@ import { CompressionMethod } from './constants';

@@ -207,2 +207,3 @@ "use strict";

const cacheSize = utils.getArchiveFileSizeIsBytes(archivePath);
core.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`);
const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize);

@@ -209,0 +210,0 @@ if (!requestUtils_1.isSuccessStatusCode(commitCacheResponse.statusCode)) {

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare enum CacheFilename {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { TransferProgressEvent } from '@azure/ms-rest-js';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IHttpClientResponse, ITypedResponse } from '@actions/http-client/interfaces';

@@ -0,0 +0,0 @@ "use strict";

import { CompressionMethod } from './constants';
export declare function extractTar(archivePath: string, compressionMethod: CompressionMethod): Promise<void>;
export declare function createTar(archiveFolder: string, sourceDirectories: string[], compressionMethod: CompressionMethod): Promise<void>;
export declare function listTar(archivePath: string, compressionMethod: CompressionMethod): Promise<void>;

@@ -27,16 +27,27 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
const IS_WINDOWS = process.platform === 'win32';
if (IS_WINDOWS) {
const systemTar = `${process.env['windir']}\\System32\\tar.exe`;
if (compressionMethod !== constants_1.CompressionMethod.Gzip) {
// We only use zstandard compression on windows when gnu tar is installed due to
// a bug with compressing large files with bsdtar + zstd
args.push('--force-local');
switch (process.platform) {
case 'win32': {
const systemTar = `${process.env['windir']}\\System32\\tar.exe`;
if (compressionMethod !== constants_1.CompressionMethod.Gzip) {
// We only use zstandard compression on windows when gnu tar is installed due to
// a bug with compressing large files with bsdtar + zstd
args.push('--force-local');
}
else if (fs_1.existsSync(systemTar)) {
return systemTar;
}
else if (yield utils.isGnuTarInstalled()) {
args.push('--force-local');
}
break;
}
else if (fs_1.existsSync(systemTar)) {
return systemTar;
case 'darwin': {
const gnuTar = yield io.which('gtar', false);
if (gnuTar) {
return gnuTar;
}
break;
}
else if (yield utils.isGnuTarInstalled()) {
args.push('--force-local');
}
default:
break;
}

@@ -126,2 +137,28 @@ return yield io.which('tar', true);

exports.createTar = createTar;
function listTar(archivePath, compressionMethod) {
return __awaiter(this, void 0, void 0, function* () {
// --d: Decompress.
// --long=#: Enables long distance matching with # bits.
// Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
// Using 30 here because we also support 32-bit self-hosted runners.
function getCompressionProgram() {
switch (compressionMethod) {
case constants_1.CompressionMethod.Zstd:
return ['--use-compress-program', 'zstd -d --long=30'];
case constants_1.CompressionMethod.ZstdWithoutLong:
return ['--use-compress-program', 'zstd -d'];
default:
return ['-z'];
}
}
const args = [
...getCompressionProgram(),
'-tf',
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
'-P'
];
yield execTar(args, compressionMethod);
});
}
exports.listTar = listTar;
//# sourceMappingURL=tar.js.map

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ The MIT License (MIT)

2

package.json
{
"name": "@actions/cache",
"version": "1.0.5",
"version": "1.0.6",
"preview": true,

@@ -5,0 +5,0 @@ "description": "Actions cache lib",

@@ -0,0 +0,0 @@ # `@actions/cache`

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc