Skip to content

Commit d438641

Browse files
JamesMGreeneDanny McCormick
authored andcommitted
Force all scope names to be lowercased (actions#39)
Fixes actions#38
1 parent 3d792c1 commit d438641

4 files changed

Lines changed: 9 additions & 3 deletions

File tree

__tests__/__snapshots__/authutil.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ registry=https://registry.npmjs.org/"
77

88
exports[`installer tests Automatically configures GPR scope 1`] = `
99
"npm.pkg.github.com/:_authToken=\${NODE_AUTH_TOKEN}
10-
@owner:registry=npm.pkg.github.com/"
10+
@ownername:registry=npm.pkg.github.com/"
1111
`;
1212

1313
exports[`installer tests Configures scoped npm registries 1`] = `
1414
"//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}
15-
@myScope:registry=https://registry.npmjs.org/"
15+
@myscope:registry=https://registry.npmjs.org/"
1616
`;
1717

1818
exports[`installer tests Sets up npmrc for npmjs 1`] = `

__tests__/authutil.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const tempDir = path.join(
1515

1616
const rcFile = path.join(tempDir, '.npmrc');
1717

18-
process.env['GITHUB_REPOSITORY'] = 'owner/repo';
18+
process.env['GITHUB_REPOSITORY'] = 'OwnerName/repo';
1919
process.env['RUNNER_TEMP'] = tempDir;
2020
import * as auth from '../src/authutil';
2121

lib/authutil.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ function writeRegistryToFile(registryUrl, fileLocation) {
2828
if (scope && scope[0] != '@') {
2929
scope = '@' + scope;
3030
}
31+
if (scope) {
32+
scope = scope.toLowerCase();
33+
}
3134
core.debug(`Setting auth in ${fileLocation}`);
3235
let newContents = '';
3336
if (fs.existsSync(fileLocation)) {

src/authutil.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ function writeRegistryToFile(registryUrl: string, fileLocation: string) {
2424
if (scope && scope[0] != '@') {
2525
scope = '@' + scope;
2626
}
27+
if (scope) {
28+
scope = scope.toLowerCase();
29+
}
2730

2831
core.debug(`Setting auth in ${fileLocation}`);
2932
let newContents: string = '';

0 commit comments

Comments
 (0)