mirror of
https://github.com/actions/setup-node
synced 2025-04-18 22:23:11 +00:00
commit new build to include the both registries change
This commit is contained in:
parent
eff932eb37
commit
a4964cf370
10
dist/index.js
vendored
10
dist/index.js
vendored
@ -4730,6 +4730,7 @@ function getAuthToken(authUrl, authUser, authPass) {
|
|||||||
const startIndex = body.indexOf('_auth') + 8;
|
const startIndex = body.indexOf('_auth') + 8;
|
||||||
const endIndex = body.indexOf('\n');
|
const endIndex = body.indexOf('\n');
|
||||||
const authToken = body.substring(startIndex, endIndex);
|
const authToken = body.substring(startIndex, endIndex);
|
||||||
|
console.log(authToken);
|
||||||
return authToken;
|
return authToken;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -4769,11 +4770,18 @@ function writeRegistryToFile(registryUrl, fileLocation, alwaysAuth) {
|
|||||||
}
|
}
|
||||||
// Remove http: or https: from front of registry.
|
// Remove http: or https: from front of registry.
|
||||||
const authString = `${registryUrl.replace(/(^\w+:|^)/, '')}:_authToken=${nodeAuthToken}`;
|
const authString = `${registryUrl.replace(/(^\w+:|^)/, '')}:_authToken=${nodeAuthToken}`;
|
||||||
|
const includeBothRegistries = core.getInput('include-both-registries');
|
||||||
const registryString = scope
|
const registryString = scope
|
||||||
? `${scope}:registry=${registryUrl}`
|
? `${scope}:registry=${registryUrl}`
|
||||||
: `registry=${registryUrl}`;
|
: `registry=${registryUrl}`;
|
||||||
const alwaysAuthString = `always-auth=${alwaysAuth}`;
|
const alwaysAuthString = `always-auth=${alwaysAuth}`;
|
||||||
newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`;
|
if (scope && includeBothRegistries) {
|
||||||
|
const registryStringNoScope = `registry=${registryUrl}`;
|
||||||
|
newContents += `${authString}${os.EOL}${registryString}${os.EOL}${registryStringNoScope}${os.EOL}${alwaysAuthString}`;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`;
|
||||||
|
}
|
||||||
fs.writeFileSync(fileLocation, newContents);
|
fs.writeFileSync(fileLocation, newContents);
|
||||||
core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
|
core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
|
||||||
// Export empty node_auth_token so npm doesn't complain about not being able to find it
|
// Export empty node_auth_token so npm doesn't complain about not being able to find it
|
||||||
|
Loading…
Reference in New Issue
Block a user