mirror of
				https://kkgithub.com/actions/setup-node.git
				synced 2025-11-01 03:01:53 +08:00 
			
		
		
		
	npmrc in RUNNER_TEMP
This commit is contained in:
		| @ -13,7 +13,7 @@ const path = __importStar(require("path")); | ||||
| const core = __importStar(require("@actions/core")); | ||||
| const github = __importStar(require("@actions/github")); | ||||
| function configAuthentication(registryUrl) { | ||||
|     const npmrc = path.resolve(process.cwd(), '.npmrc'); | ||||
|     const npmrc = path.resolve(process.env['RUNNER_TEMP'] || process.cwd(), '.npmrc'); | ||||
|     writeRegistryToFile(registryUrl, npmrc); | ||||
| } | ||||
| exports.configAuthentication = configAuthentication; | ||||
| @ -38,7 +38,10 @@ function writeRegistryToFile(registryUrl, fileLocation) { | ||||
|     } | ||||
|     // Remove http: or https: from front of registry. | ||||
|     const authString = registryUrl.replace(/(^\w+:|^)/, '') + ':_authToken=${NODE_AUTH_TOKEN}'; | ||||
|     const registryString = scope ? `${scope}:registry=${registryUrl}` : `registry=${registryUrl}`; | ||||
|     const registryString = scope | ||||
|         ? `${scope}:registry=${registryUrl}` | ||||
|         : `registry=${registryUrl}`; | ||||
|     newContents += `${registryString}${os.EOL}always-auth=true${os.EOL}${authString}`; | ||||
|     fs.writeFileSync(fileLocation, newContents); | ||||
|     core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation); | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Danny McCormick
					Danny McCormick