mirror of
https://github.com/actions/setup-node
synced 2025-04-09 10:25:52 +00:00
add node auth token env
This commit is contained in:
parent
a4964cf370
commit
f5faff30bb
2 changed files with 17 additions and 6 deletions
12
dist/index.js
vendored
12
dist/index.js
vendored
|
@ -4758,7 +4758,8 @@ function writeRegistryToFile(registryUrl, fileLocation, alwaysAuth) {
|
|||
}
|
||||
});
|
||||
}
|
||||
let nodeAuthToken = '${NODE_AUTH_TOKEN}';
|
||||
let defaultNodeAuthToken = '${NODE_AUTH_TOKEN}';
|
||||
let nodeAuthToken = defaultNodeAuthToken;
|
||||
// Check if auth url provided
|
||||
const authUrl = core.getInput('auth-url');
|
||||
if (authUrl) {
|
||||
|
@ -4784,8 +4785,13 @@ function writeRegistryToFile(registryUrl, fileLocation, alwaysAuth) {
|
|||
}
|
||||
fs.writeFileSync(fileLocation, newContents);
|
||||
core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
|
||||
// Export empty node_auth_token so npm doesn't complain about not being able to find it
|
||||
core.exportVariable('NODE_AUTH_TOKEN', 'XXXXX-XXXXX-XXXXX-XXXXX');
|
||||
if (defaultNodeAuthToken !== nodeAuthToken) {
|
||||
core.exportVariable('NODE_AUTH_TOKEN', nodeAuthToken);
|
||||
}
|
||||
else {
|
||||
// Export empty node_auth_token so npm doesn't complain about not being able to find it
|
||||
core.exportVariable('NODE_AUTH_TOKEN', 'XXXXX-XXXXX-XXXXX-XXXXX');
|
||||
}
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=authutil.js.map
|
||||
|
|
|
@ -76,7 +76,8 @@ async function writeRegistryToFile(
|
|||
});
|
||||
}
|
||||
|
||||
let nodeAuthToken = '${NODE_AUTH_TOKEN}';
|
||||
let defaultNodeAuthToken = '${NODE_AUTH_TOKEN}';
|
||||
let nodeAuthToken = defaultNodeAuthToken;
|
||||
// Check if auth url provided
|
||||
const authUrl: string = core.getInput('auth-url');
|
||||
if (authUrl) {
|
||||
|
@ -108,6 +109,10 @@ async function writeRegistryToFile(
|
|||
|
||||
fs.writeFileSync(fileLocation, newContents);
|
||||
core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
|
||||
// Export empty node_auth_token so npm doesn't complain about not being able to find it
|
||||
core.exportVariable('NODE_AUTH_TOKEN', 'XXXXX-XXXXX-XXXXX-XXXXX');
|
||||
if (defaultNodeAuthToken !== nodeAuthToken) {
|
||||
core.exportVariable('NODE_AUTH_TOKEN', nodeAuthToken)
|
||||
} else {
|
||||
// Export empty node_auth_token so npm doesn't complain about not being able to find it
|
||||
core.exportVariable('NODE_AUTH_TOKEN', 'XXXXX-XXXXX-XXXXX-XXXXX');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue