3
0
Fork 0
mirror of https://gitea.com/actions/setup-node.git synced 2024-11-24 11:09:33 +01:00

Update authutil.js

This commit is contained in:
Danny McCormick 2019-08-06 16:39:01 -04:00 committed by GitHub
parent 40a00ae373
commit ae3937cacb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,15 +30,7 @@ function writeRegistryToFile(registryUrl, fileLocation) {
} }
core.debug(`Setting auth in ${fileLocation}`); core.debug(`Setting auth in ${fileLocation}`);
let newContents = ''; let newContents = '';
if (fs.existsSync(fileLocation)) {
const curContents = fs.readFileSync(fileLocation, 'utf8');
curContents.split(os.EOL).forEach((line) => {
// Add current contents unless they are setting the registry
if (!line.toLowerCase().startsWith('registry')) {
newContents += line + os.EOL;
}
});
}
// Remove http: or https: from front of registry. // Remove http: or https: from front of registry.
const authString = registryUrl.replace(/(^\w+:|^)/, '') + ':_authToken=${NODE_AUTH_TOKEN}'; const authString = registryUrl.replace(/(^\w+:|^)/, '') + ':_authToken=${NODE_AUTH_TOKEN}';
const registryString = scope const registryString = scope