@@ -26,23 +26,12 @@ index 4658366..b796e58 100644
26
26
+ constructor(key: string, size?: number);
27
27
+ }
28
28
diff --git a/node_modules/@actions/cache/lib/cache.js b/node_modules/@actions/cache/lib/cache.js
29
- index 0fa9df3..5f0b173 100644
29
+ index 9d636aa..a176bd7 100644
30
30
--- a/node_modules/@actions/cache/lib/cache.js
31
31
+++ b/node_modules/@actions/cache/lib/cache.js
32
- @@ -97,26 +97,18 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
33
- }
34
- archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
35
- core.debug(`Archive Path: ${archivePath}`);
36
- + const restoredEntry = new CacheEntry(cacheEntry.cacheKey);
37
- // Download the cache from the cache entry
38
- yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options);
39
- if (core.isDebug()) {
40
- yield tar_1.listTar(archivePath, compressionMethod);
41
- }
42
- const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
43
- + restoredEntry.size = archiveFileSize;
32
+ @@ -127,18 +127,21 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
44
33
core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
45
- yield tar_1.extractTar(archivePath, compressionMethod);
34
+ yield (0, tar_1.extractTar) (archivePath, compressionMethod);
46
35
core.info('Cache restored successfully');
47
36
- return cacheEntry.cacheKey;
48
37
- }
@@ -55,29 +44,31 @@ index 0fa9df3..5f0b173 100644
55
44
- // Supress all non-validation cache related errors because caching should be optional
56
45
- core.warning(`Failed to restore: ${error.message}`);
57
46
- }
58
- + return restoredEntry;
47
+ +
48
+ + // PATCHED - Return more inforamtion about restored entry
49
+ + return new CacheEntry(cacheEntry.cacheKey, archiveFileSize);;
59
50
}
51
+ + // PATCHED - propagate errors
52
+ + // catch (error) {
53
+ + // const typedError = error;
54
+ + // if (typedError.name === ValidationError.name) {
55
+ + // throw error;
56
+ + // }
57
+ + // else {
58
+ + // // Supress all non-validation cache related errors because caching should be optional
59
+ + // core.warning(`Failed to restore: ${error.message}`);
60
+ + // }
61
+ + // }
60
62
finally {
61
63
// Try to delete the archive to save space
62
- @@ -156,6 +148,7 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
63
- const archiveFolder = yield utils.createTempDirectory();
64
- const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
65
- core.debug(`Archive Path: ${archivePath}`);
66
- + const savedEntry = new CacheEntry(key);
67
- try {
68
- yield tar_1.createTar(archiveFolder, cachePaths, compressionMethod);
69
- if (core.isDebug()) {
70
- @@ -163,6 +156,7 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
64
+ try {
65
+ @@ -206,19 +209,23 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
71
66
}
72
- const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
73
- const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
74
- + savedEntry.size = archiveFileSize;
75
- core.debug(`File Size: ${archiveFileSize}`);
76
- // For GHES, this check will take place in ReserveCache API with enterprise file size limit
77
- if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
78
- @@ -186,18 +180,6 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
79
67
core.debug(`Saving Cache (ID: ${cacheId})`);
80
68
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
69
+ +
70
+ + // PATCHED - Return more inforamtion about saved entry
71
+ + return new CacheEntry(key, archiveFileSize);
81
72
}
82
73
- catch (error) {
83
74
- const typedError = error;
@@ -91,15 +82,23 @@ index 0fa9df3..5f0b173 100644
91
82
- core.warning(`Failed to save: ${typedError.message}`);
92
83
- }
93
84
- }
85
+ + // PATCHED - propagate errors
86
+ + // catch (error) {
87
+ + // const typedError = error;
88
+ + // if (typedError.name === ValidationError.name) {
89
+ + // throw error;
90
+ + // }
91
+ + // else if (typedError.name === ReserveCacheError.name) {
92
+ + // core.info(`Failed to save: ${typedError.message}`);
93
+ + // }
94
+ + // else {
95
+ + // core.warning(`Failed to save: ${typedError.message}`);
96
+ + // }
97
+ + // }
94
98
finally {
95
99
// Try to delete the archive to save space
96
100
try {
97
- @@ -207,8 +189,15 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
98
- core.debug(`Failed to delete archive: ${error}`);
99
- }
100
- }
101
- - return cacheId;
102
- + return savedEntry;
101
+ @@ -232,4 +239,11 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
103
102
});
104
103
}
105
104
exports.saveCache = saveCache;
0 commit comments