mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 13:29:12 +08:00 
			
		
		
		
	
				
					committed by
					
						
						Danny McCormick
					
				
			
			
				
	
			
			
			
						parent
						
							3d792c1dbd
						
					
				
				
					commit
					d43864199a
				
			@@ -7,12 +7,12 @@ registry=https://registry.npmjs.org/"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
exports[`installer tests Automatically configures GPR scope 1`] = `
 | 
					exports[`installer tests Automatically configures GPR scope 1`] = `
 | 
				
			||||||
"npm.pkg.github.com/:_authToken=\${NODE_AUTH_TOKEN}
 | 
					"npm.pkg.github.com/:_authToken=\${NODE_AUTH_TOKEN}
 | 
				
			||||||
@owner:registry=npm.pkg.github.com/"
 | 
					@ownername:registry=npm.pkg.github.com/"
 | 
				
			||||||
`;
 | 
					`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports[`installer tests Configures scoped npm registries 1`] = `
 | 
					exports[`installer tests Configures scoped npm registries 1`] = `
 | 
				
			||||||
"//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}
 | 
					"//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}
 | 
				
			||||||
@myScope:registry=https://registry.npmjs.org/"
 | 
					@myscope:registry=https://registry.npmjs.org/"
 | 
				
			||||||
`;
 | 
					`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports[`installer tests Sets up npmrc for npmjs 1`] = `
 | 
					exports[`installer tests Sets up npmrc for npmjs 1`] = `
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@ const tempDir = path.join(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const rcFile = path.join(tempDir, '.npmrc');
 | 
					const rcFile = path.join(tempDir, '.npmrc');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
process.env['GITHUB_REPOSITORY'] = 'owner/repo';
 | 
					process.env['GITHUB_REPOSITORY'] = 'OwnerName/repo';
 | 
				
			||||||
process.env['RUNNER_TEMP'] = tempDir;
 | 
					process.env['RUNNER_TEMP'] = tempDir;
 | 
				
			||||||
import * as auth from '../src/authutil';
 | 
					import * as auth from '../src/authutil';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,6 +28,9 @@ function writeRegistryToFile(registryUrl, fileLocation) {
 | 
				
			|||||||
    if (scope && scope[0] != '@') {
 | 
					    if (scope && scope[0] != '@') {
 | 
				
			||||||
        scope = '@' + scope;
 | 
					        scope = '@' + scope;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (scope) {
 | 
				
			||||||
 | 
					        scope = scope.toLowerCase();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    core.debug(`Setting auth in ${fileLocation}`);
 | 
					    core.debug(`Setting auth in ${fileLocation}`);
 | 
				
			||||||
    let newContents = '';
 | 
					    let newContents = '';
 | 
				
			||||||
    if (fs.existsSync(fileLocation)) {
 | 
					    if (fs.existsSync(fileLocation)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,6 +24,9 @@ function writeRegistryToFile(registryUrl: string, fileLocation: string) {
 | 
				
			|||||||
  if (scope && scope[0] != '@') {
 | 
					  if (scope && scope[0] != '@') {
 | 
				
			||||||
    scope = '@' + scope;
 | 
					    scope = '@' + scope;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  if (scope) {
 | 
				
			||||||
 | 
					    scope = scope.toLowerCase();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  core.debug(`Setting auth in ${fileLocation}`);
 | 
					  core.debug(`Setting auth in ${fileLocation}`);
 | 
				
			||||||
  let newContents: string = '';
 | 
					  let newContents: string = '';
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user