From eda4a77b7cd298a53357f044f7962c369ccd0713 Mon Sep 17 00:00:00 2001
From: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Date: Fri, 23 Dec 2022 14:24:29 +0100
Subject: [PATCH] Add new actions/cache version (with dryRun support)

---
 dist/restore-only/index.js | 11 ++++++++++-
 dist/restore/index.js      | 11 ++++++++++-
 dist/save-only/index.js    | 11 ++++++++++-
 dist/save/index.js         | 11 ++++++++++-
 package-lock.json          | 12 ++++++------
 package.json               |  2 +-
 6 files changed, 47 insertions(+), 11 deletions(-)

diff --git a/dist/restore-only/index.js b/dist/restore-only/index.js
index f676abb..9c5d59f 100644
--- a/dist/restore-only/index.js
+++ b/dist/restore-only/index.js
@@ -41808,7 +41808,8 @@ function getDownloadOptions(copy) {
         useAzureSdk: true,
         downloadConcurrency: 8,
         timeoutInMs: 30000,
-        segmentTimeoutInMs: 3600000
+        segmentTimeoutInMs: 3600000,
+        dryRun: false
     };
     if (copy) {
         if (typeof copy.useAzureSdk === 'boolean') {
@@ -41823,6 +41824,9 @@ function getDownloadOptions(copy) {
         if (typeof copy.segmentTimeoutInMs === 'number') {
             result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
         }
+        if (typeof copy.dryRun === 'boolean') {
+            result.dryRun = copy.dryRun;
+        }
     }
     const segmentDownloadTimeoutMins = process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS'];
     if (segmentDownloadTimeoutMins &&
@@ -41835,6 +41839,7 @@ function getDownloadOptions(copy) {
     core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
     core.debug(`Cache segment download timeout mins env var: ${process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']}`);
     core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`);
+    core.debug(`Dry run: ${result.dryRun}`);
     return result;
 }
 exports.getDownloadOptions = getDownloadOptions;
@@ -47283,6 +47288,10 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
                 // Cache not found
                 return undefined;
             }
+            if (options === null || options === void 0 ? void 0 : options.dryRun) {
+                core.info('Dry run - skipping download');
+                return cacheEntry.cacheKey;
+            }
             archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
             core.debug(`Archive Path: ${archivePath}`);
             // Download the cache from the cache entry
diff --git a/dist/restore/index.js b/dist/restore/index.js
index 6415478..942a113 100644
--- a/dist/restore/index.js
+++ b/dist/restore/index.js
@@ -41779,7 +41779,8 @@ function getDownloadOptions(copy) {
         useAzureSdk: true,
         downloadConcurrency: 8,
         timeoutInMs: 30000,
-        segmentTimeoutInMs: 3600000
+        segmentTimeoutInMs: 3600000,
+        dryRun: false
     };
     if (copy) {
         if (typeof copy.useAzureSdk === 'boolean') {
@@ -41794,6 +41795,9 @@ function getDownloadOptions(copy) {
         if (typeof copy.segmentTimeoutInMs === 'number') {
             result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
         }
+        if (typeof copy.dryRun === 'boolean') {
+            result.dryRun = copy.dryRun;
+        }
     }
     const segmentDownloadTimeoutMins = process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS'];
     if (segmentDownloadTimeoutMins &&
@@ -41806,6 +41810,7 @@ function getDownloadOptions(copy) {
     core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
     core.debug(`Cache segment download timeout mins env var: ${process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']}`);
     core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`);
+    core.debug(`Dry run: ${result.dryRun}`);
     return result;
 }
 exports.getDownloadOptions = getDownloadOptions;
@@ -47254,6 +47259,10 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
                 // Cache not found
                 return undefined;
             }
+            if (options === null || options === void 0 ? void 0 : options.dryRun) {
+                core.info('Dry run - skipping download');
+                return cacheEntry.cacheKey;
+            }
             archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
             core.debug(`Archive Path: ${archivePath}`);
             // Download the cache from the cache entry
diff --git a/dist/save-only/index.js b/dist/save-only/index.js
index 0d3295c..17d2b2e 100644
--- a/dist/save-only/index.js
+++ b/dist/save-only/index.js
@@ -41920,7 +41920,8 @@ function getDownloadOptions(copy) {
         useAzureSdk: true,
         downloadConcurrency: 8,
         timeoutInMs: 30000,
-        segmentTimeoutInMs: 3600000
+        segmentTimeoutInMs: 3600000,
+        dryRun: false
     };
     if (copy) {
         if (typeof copy.useAzureSdk === 'boolean') {
@@ -41935,6 +41936,9 @@ function getDownloadOptions(copy) {
         if (typeof copy.segmentTimeoutInMs === 'number') {
             result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
         }
+        if (typeof copy.dryRun === 'boolean') {
+            result.dryRun = copy.dryRun;
+        }
     }
     const segmentDownloadTimeoutMins = process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS'];
     if (segmentDownloadTimeoutMins &&
@@ -41947,6 +41951,7 @@ function getDownloadOptions(copy) {
     core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
     core.debug(`Cache segment download timeout mins env var: ${process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']}`);
     core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`);
+    core.debug(`Dry run: ${result.dryRun}`);
     return result;
 }
 exports.getDownloadOptions = getDownloadOptions;
@@ -47395,6 +47400,10 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
                 // Cache not found
                 return undefined;
             }
+            if (options === null || options === void 0 ? void 0 : options.dryRun) {
+                core.info('Dry run - skipping download');
+                return cacheEntry.cacheKey;
+            }
             archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
             core.debug(`Archive Path: ${archivePath}`);
             // Download the cache from the cache entry
diff --git a/dist/save/index.js b/dist/save/index.js
index 1b0a733..a420c5e 100644
--- a/dist/save/index.js
+++ b/dist/save/index.js
@@ -41864,7 +41864,8 @@ function getDownloadOptions(copy) {
         useAzureSdk: true,
         downloadConcurrency: 8,
         timeoutInMs: 30000,
-        segmentTimeoutInMs: 3600000
+        segmentTimeoutInMs: 3600000,
+        dryRun: false
     };
     if (copy) {
         if (typeof copy.useAzureSdk === 'boolean') {
@@ -41879,6 +41880,9 @@ function getDownloadOptions(copy) {
         if (typeof copy.segmentTimeoutInMs === 'number') {
             result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
         }
+        if (typeof copy.dryRun === 'boolean') {
+            result.dryRun = copy.dryRun;
+        }
     }
     const segmentDownloadTimeoutMins = process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS'];
     if (segmentDownloadTimeoutMins &&
@@ -41891,6 +41895,7 @@ function getDownloadOptions(copy) {
     core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
     core.debug(`Cache segment download timeout mins env var: ${process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']}`);
     core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`);
+    core.debug(`Dry run: ${result.dryRun}`);
     return result;
 }
 exports.getDownloadOptions = getDownloadOptions;
@@ -47368,6 +47373,10 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
                 // Cache not found
                 return undefined;
             }
+            if (options === null || options === void 0 ? void 0 : options.dryRun) {
+                core.info('Dry run - skipping download');
+                return cacheEntry.cacheKey;
+            }
             archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
             core.debug(`Archive Path: ${archivePath}`);
             // Download the cache from the cache entry
diff --git a/package-lock.json b/package-lock.json
index eb8e5f9..7e29cb4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,7 +9,7 @@
       "version": "3.2.2",
       "license": "MIT",
       "dependencies": {
-        "@actions/cache": "^3.1.2",
+        "@actions/cache": "https://github.com/cdce8p/toolkit/raw/cache-dry-run-release/packages/cache/actions-cache-3.1.2.tgz",
         "@actions/core": "^1.10.0",
         "@actions/exec": "^1.1.1",
         "@actions/io": "^1.1.2"
@@ -37,8 +37,9 @@
     },
     "node_modules/@actions/cache": {
       "version": "3.1.2",
-      "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.1.2.tgz",
-      "integrity": "sha512-3XeKcXIonfIbqvW7gPm/VLOhv1RHQ1dtTgSBCH6OUhCgSTii9bEVgu0PIms7UbLnXeMCKFzECfpbud8fJEvBbQ==",
+      "resolved": "https://github.com/cdce8p/toolkit/raw/cache-dry-run-release/packages/cache/actions-cache-3.1.2.tgz",
+      "integrity": "sha512-1vcZXG2jWtEnDWq34byiQmS8tgOKAzFEIiMFPtxigm3vHOW+9FGdA2S+eWsK3NBLIbWd5erCkWgo4M0g6gw1yw==",
+      "license": "MIT",
       "dependencies": {
         "@actions/core": "^1.10.0",
         "@actions/exec": "^1.0.1",
@@ -9722,9 +9723,8 @@
   },
   "dependencies": {
     "@actions/cache": {
-      "version": "3.1.2",
-      "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.1.2.tgz",
-      "integrity": "sha512-3XeKcXIonfIbqvW7gPm/VLOhv1RHQ1dtTgSBCH6OUhCgSTii9bEVgu0PIms7UbLnXeMCKFzECfpbud8fJEvBbQ==",
+      "version": "https://github.com/cdce8p/toolkit/raw/cache-dry-run-release/packages/cache/actions-cache-3.1.2.tgz",
+      "integrity": "sha512-1vcZXG2jWtEnDWq34byiQmS8tgOKAzFEIiMFPtxigm3vHOW+9FGdA2S+eWsK3NBLIbWd5erCkWgo4M0g6gw1yw==",
       "requires": {
         "@actions/core": "^1.10.0",
         "@actions/exec": "^1.0.1",
diff --git a/package.json b/package.json
index 7046c20..6926cac 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
   "author": "GitHub",
   "license": "MIT",
   "dependencies": {
-    "@actions/cache": "^3.1.2",
+    "@actions/cache": "https://github.com/cdce8p/toolkit/raw/cache-dry-run-release/packages/cache/actions-cache-3.1.2.tgz",
     "@actions/core": "^1.10.0",
     "@actions/exec": "^1.1.1",
     "@actions/io": "^1.1.2"