Unverified Commit aef30aae authored by daz's avatar daz
Browse files

Tidy up patch file

parent 4c8d89b2
Loading
Loading
Loading
Loading
+18 −17
Changes for sources/patches/@actions+cache+4.0.0.patch: 18 added lines, 17 removed lines.
Original line number Diff line number Diff line
diff --git a/node_modules/@actions/cache/lib/cache.d.ts b/node_modules/@actions/cache/lib/cache.d.ts
index ef0928b..e011501 100644
index ef0928b..4e2f570 100644
--- a/node_modules/@actions/cache/lib/cache.d.ts
+++ b/node_modules/@actions/cache/lib/cache.d.ts
@@ -21,8 +21,7 @@ export declare function isFeatureAvailable(): boolean;
@@ -21,7 +21,7 @@ export declare function isFeatureAvailable(): boolean;
  * @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
  * @returns string returns the key for the cache hit, otherwise returns undefined
  */
-export declare function restoreCache(paths: string[], primaryKey: string, restoreKeys?: string[], options?: DownloadOptions, enableCrossOsArchive?: boolean): Promise<string | undefined>;
-/**
+export declare function restoreCache(paths: string[], primaryKey: string, restoreKeys?: string[], options?: DownloadOptions, enableCrossOsArchive?: boolean): Promise<CacheEntry | undefined>;/**
+export declare function restoreCache(paths: string[], primaryKey: string, restoreKeys?: string[], options?: DownloadOptions, enableCrossOsArchive?: boolean): Promise<CacheEntry | undefined>;
 /**
  * Saves a list of files with the specified key
  *
  * @param paths a list of file paths to be cached
@@ -31,4 +30,12 @@ export declare function restoreCache(paths: string[], primaryKey: string, restor
@@ -31,4 +31,12 @@ export declare function restoreCache(paths: string[], primaryKey: string, restor
  * @param options cache upload options
  * @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
  */
@@ -28,10 +27,10 @@ index ef0928b..e011501 100644
+}
\ No newline at end of file
diff --git a/node_modules/@actions/cache/lib/cache.js b/node_modules/@actions/cache/lib/cache.js
index 45201b6..f3a26d2 100644
index 45201b6..2654e4b 100644
--- a/node_modules/@actions/cache/lib/cache.js
+++ b/node_modules/@actions/cache/lib/cache.js
@@ -154,18 +154,20 @@ function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsAr
@@ -154,18 +154,21 @@ function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsAr
             core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
             yield (0, tar_1.extractTar)(archivePath, compressionMethod);
             core.info('Cache restored successfully');
@@ -46,7 +45,8 @@ index 45201b6..f3a26d2 100644
-                // Supress all non-validation cache related errors because caching should be optional
-                core.warning(`Failed to restore: ${error.message}`);
-            }
+            // PATCHED - Return more inforamtion about restored entry
+
+            // PATCHED - Include size of restored entry
+            return new CacheEntry(cacheEntry.cacheKey, archiveFileSize);;
         }
+            // PATCHED - propagate errors
@@ -63,7 +63,7 @@ index 45201b6..f3a26d2 100644
         finally {
             // Try to delete the archive to save space
             try {
@@ -232,18 +234,20 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
@@ -232,18 +235,21 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
             }
             yield (0, tar_1.extractTar)(archivePath, compressionMethod);
             core.info('Cache restored successfully');
@@ -78,7 +78,8 @@ index 45201b6..f3a26d2 100644
-                // Supress all non-validation cache related errors because caching should be optional
-                core.warning(`Failed to restore: ${error.message}`);
-            }
+            // PATCHED - Return more inforamtion about restored entry
+
+            // PATCHED - Include size of restored entry
+            return new CacheEntry(response.matchedKey, archiveFileSize);;
         }
+            // PATCHED - propagate errors
@@ -95,12 +96,12 @@ index 45201b6..f3a26d2 100644
         finally {
             try {
                 if (archivePath) {
@@ -334,19 +338,23 @@ function saveCacheV1(paths, key, options, enableCrossOsArchive = false) {
@@ -334,19 +340,23 @@ function saveCacheV1(paths, key, options, enableCrossOsArchive = false) {
             }
             core.debug(`Saving Cache (ID: ${cacheId})`);
             yield cacheHttpClient.saveCache(cacheId, archivePath, '', options);
+
+            // PATCHED - Return more inforamtion about saved entry
+            // PATCHED - Include size of saved entry
+            return new CacheEntry(key, archiveFileSize);
         }
-        catch (error) {
@@ -131,12 +132,12 @@ index 45201b6..f3a26d2 100644
         finally {
             // Try to delete the archive to save space
             try {
@@ -422,19 +430,23 @@ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
@@ -422,19 +432,23 @@ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
                 throw new Error(`Unable to finalize cache with key ${key}, another job may be finalizing this cache.`);
             }
             cacheId = parseInt(finalizeResponse.entryId);
+
+            // PATCHED - Return more inforamtion about saved entry
+            // PATCHED - Include size of saved entry
+            return new CacheEntry(key, archiveFileSize);
         }
-        catch (error) {
@@ -167,16 +168,16 @@ index 45201b6..f3a26d2 100644
         finally {
             // Try to delete the archive to save space
             try {
@@ -447,4 +459,11 @@ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
@@ -447,4 +461,11 @@ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
         return cacheId;
     });
 }
+// PATCHED - CacheEntry class
+class CacheEntry {
+    constructor(key, size) {
+        this.key = key;
+        this.size = size;
+    }
+}
+exports.CacheEntry = CacheEntry;
 //# sourceMappingURL=cache.js.map
\ No newline at end of file