mirror of
https://github.com/actions/setup-node.git
synced 2025-08-02 00:16:44 +08:00
npmrc in RUNNER_TEMP
This commit is contained in:
@@ -5,7 +5,10 @@ import * as core from '@actions/core';
|
||||
import * as github from '@actions/github';
|
||||
|
||||
export function configAuthentication(registryUrl: string) {
|
||||
const npmrc: string = path.resolve(process.cwd(), '.npmrc');
|
||||
const npmrc: string = path.resolve(
|
||||
process.env['RUNNER_TEMP'] || process.cwd(),
|
||||
'.npmrc'
|
||||
);
|
||||
|
||||
writeRegistryToFile(registryUrl, npmrc);
|
||||
}
|
||||
@@ -38,4 +41,5 @@ function writeRegistryToFile(registryUrl: string, fileLocation: string) {
|
||||
: `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