From 27b8ea9368cf428f0bfe41b0876b1a7e809d9844 Mon Sep 17 00:00:00 2001
From: Linda_pp <rhysd@users.noreply.github.com>
Date: Sat, 8 Feb 2025 23:36:01 +0900
Subject: [PATCH] Include CPU arch in the cache key (#228)

---
 dist/restore/index.js | 5 +++--
 dist/save/index.js    | 5 +++--
 src/config.ts         | 5 +++--
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/dist/restore/index.js b/dist/restore/index.js
index ea98ed1..d92653b 100644
--- a/dist/restore/index.js
+++ b/dist/restore/index.js
@@ -86755,9 +86755,10 @@ class CacheConfig {
                 key += `-${job}`;
             }
         }
-        // Add runner OS to the key to avoid cross-contamination of cache
+        // Add runner OS and CPU architecture to the key to avoid cross-contamination of cache
         const runnerOS = external_os_default().type();
-        key += `-${runnerOS}`;
+        const runnerArch = external_os_default().arch();
+        key += `-${runnerOS}-${runnerArch}`;
         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 ea2ddfb..b23f081 100644
--- a/dist/save/index.js
+++ b/dist/save/index.js
@@ -86755,9 +86755,10 @@ class CacheConfig {
                 key += `-${job}`;
             }
         }
-        // Add runner OS to the key to avoid cross-contamination of cache
+        // Add runner OS and CPU architecture to the key to avoid cross-contamination of cache
         const runnerOS = external_os_default().type();
-        key += `-${runnerOS}`;
+        const runnerArch = external_os_default().arch();
+        key += `-${runnerOS}-${runnerArch}`;
         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 5104f5c..e592916 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -74,9 +74,10 @@ export class CacheConfig {
       }
     }
 
-    // Add runner OS to the key to avoid cross-contamination of cache
+    // Add runner OS and CPU architecture to the key to avoid cross-contamination of cache
     const runnerOS = os.type();
-    key += `-${runnerOS}`;
+    const runnerArch = os.arch();
+    key += `-${runnerOS}-${runnerArch}`;
 
     self.keyPrefix = key;