mirror of
				https://github.com/actions/setup-node.git
				synced 2025-10-31 16:14:00 +08:00 
			
		
		
		
	fix: add arch to cached path (#843)
* fix: add arch to cached path * fix: change from using env to os module * fix: use process.env.RUNNER_OS instead of os.platform() * fix: remove unused var
This commit is contained in:
		| @@ -3,6 +3,7 @@ import * as core from '@actions/core'; | ||||
| import * as glob from '@actions/glob'; | ||||
| import path from 'path'; | ||||
| import fs from 'fs'; | ||||
| import os from 'os'; | ||||
|  | ||||
| import {State} from './constants'; | ||||
| import { | ||||
| @@ -21,6 +22,7 @@ export const restoreCache = async ( | ||||
|     throw new Error(`Caching for '${packageManager}' is not supported`); | ||||
|   } | ||||
|   const platform = process.env.RUNNER_OS; | ||||
|   const arch = os.arch(); | ||||
|  | ||||
|   const cachePaths = await getCacheDirectories( | ||||
|     packageManagerInfo, | ||||
| @@ -38,7 +40,7 @@ export const restoreCache = async ( | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   const keyPrefix = `node-cache-${platform}-${packageManager}`; | ||||
|   const keyPrefix = `node-cache-${platform}-${arch}-${packageManager}`; | ||||
|   const primaryKey = `${keyPrefix}-${fileHash}`; | ||||
|   core.debug(`primary key is ${primaryKey}`); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Peng Xiao
					Peng Xiao