From 9a2e0d32122f6883cb48fad7a1ac5c49f25b7661 Mon Sep 17 00:00:00 2001
From: Rano | Ranadeep <ranadip.bswas@gmail.com>
Date: Mon, 9 Dec 2024 22:32:01 +0100
Subject: [PATCH] add runner OS in cache key (#220)

---
 dist/restore/index.js | 3 +++
 dist/save/index.js    | 3 +++
 src/config.ts         | 4 ++++
 3 files changed, 10 insertions(+)

diff --git a/dist/restore/index.js b/dist/restore/index.js
index 07e4152..fc0e4d6 100644
--- a/dist/restore/index.js
+++ b/dist/restore/index.js
@@ -77314,6 +77314,9 @@ class CacheConfig {
                 key += `-${job}`;
             }
         }
+        // Add runner OS to the key to avoid cross-contamination of cache
+        const runnerOS = external_os_default().type();
+        key += `-${runnerOS}`;
         self.keyPrefix = key;
         // Construct environment portion of the key:
         // This consists of a hash that considers the rust version
diff --git a/dist/save/index.js b/dist/save/index.js
index 9b78cbe..b970acb 100644
--- a/dist/save/index.js
+++ b/dist/save/index.js
@@ -77314,6 +77314,9 @@ class CacheConfig {
                 key += `-${job}`;
             }
         }
+        // Add runner OS to the key to avoid cross-contamination of cache
+        const runnerOS = external_os_default().type();
+        key += `-${runnerOS}`;
         self.keyPrefix = key;
         // Construct environment portion of the key:
         // This consists of a hash that considers the rust version
diff --git a/src/config.ts b/src/config.ts
index 15ca1cf..2c4897a 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -71,6 +71,10 @@ export class CacheConfig {
       }
     }
 
+    // Add runner OS to the key to avoid cross-contamination of cache
+    const runnerOS = os.type();
+    key += `-${runnerOS}`;
+
     self.keyPrefix = key;
 
     // Construct environment portion of the key: