mirror of
https://github.com/actions/setup-node.git
synced 2026-02-14 17:54:50 +08:00
Compare commits
5 Commits
1f094f4152
...
54e73ce537
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54e73ce537 | ||
|
|
1d0ff469b7 | ||
|
|
55b7d827be | ||
|
|
473cb1b506 | ||
|
|
574c6daa52 |
4
.licenses/npm/@fastify/busboy.dep.yml
generated
4
.licenses/npm/@fastify/busboy.dep.yml
generated
@@ -1,9 +1,9 @@
|
||||
---
|
||||
name: "@fastify/busboy"
|
||||
version: 2.0.0
|
||||
version: 2.1.1
|
||||
type: npm
|
||||
summary: A streaming parser for HTML form data for node.js
|
||||
homepage:
|
||||
homepage:
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
|
||||
2
.licenses/npm/undici.dep.yml
generated
2
.licenses/npm/undici.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: undici
|
||||
version: 5.28.4
|
||||
version: 5.28.5
|
||||
type: npm
|
||||
summary: An HTTP/1.1 client, written from scratch for Node.js
|
||||
homepage: https://undici.nodejs.org
|
||||
|
||||
@@ -7,6 +7,7 @@ import * as auth from '../src/authutil';
|
||||
import * as cacheUtils from '../src/cache-utils';
|
||||
|
||||
let rcFile: string;
|
||||
let pkgJson: string;
|
||||
|
||||
describe('authutil tests', () => {
|
||||
const _runnerDir = path.join(__dirname, 'runner');
|
||||
@@ -25,10 +26,12 @@ describe('authutil tests', () => {
|
||||
process.env['GITHUB_REPOSITORY'] = 'OwnerName/repo';
|
||||
process.env['RUNNER_TEMP'] = tempDir;
|
||||
rcFile = path.join(tempDir, '.npmrc');
|
||||
pkgJson = path.join(tempDir, 'package.json');
|
||||
}, 100000);
|
||||
|
||||
beforeEach(async () => {
|
||||
await io.rmRF(rcFile);
|
||||
await io.rmRF(pkgJson);
|
||||
// if (fs.existsSync(rcFile)) {
|
||||
// fs.unlinkSync(rcFile);
|
||||
// }
|
||||
@@ -113,6 +116,15 @@ describe('authutil tests', () => {
|
||||
expect(rc['always-auth']).toBe('false');
|
||||
});
|
||||
|
||||
it('Automatically configures npm scope from package.json', async () => {
|
||||
process.env['INPUT_SCOPE'] = '';
|
||||
fs.writeFileSync(pkgJson, '{"name":"@myscope/mypackage"}');
|
||||
await auth.configAuthentication('https://registry.npmjs.org', '');
|
||||
|
||||
const rc = readRcFile(rcFile);
|
||||
expect(rc['@myscope:registry']).toBe('https://registry.npmjs.org/');
|
||||
});
|
||||
|
||||
it('Sets up npmrc for always-auth true', async () => {
|
||||
await auth.configAuthentication('https://registry.npmjs.org/', 'true');
|
||||
expect(fs.statSync(rcFile)).toBeDefined();
|
||||
|
||||
3075
dist/cache-save/index.js
vendored
3075
dist/cache-save/index.js
vendored
File diff suppressed because it is too large
Load Diff
3075
dist/setup/index.js
vendored
3075
dist/setup/index.js
vendored
File diff suppressed because it is too large
Load Diff
14
package-lock.json
generated
14
package-lock.json
generated
@@ -1061,9 +1061,10 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fastify/busboy": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.0.0.tgz",
|
||||
"integrity": "sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ==",
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
|
||||
"integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
@@ -5584,9 +5585,10 @@
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "5.28.4",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz",
|
||||
"integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==",
|
||||
"version": "5.28.5",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz",
|
||||
"integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fastify/busboy": "^2.0.0"
|
||||
},
|
||||
|
||||
@@ -25,6 +25,12 @@ function writeRegistryToFile(
|
||||
if (!scope && registryUrl.indexOf('npm.pkg.github.com') > -1) {
|
||||
scope = github.context.repo.owner;
|
||||
}
|
||||
if (!scope) {
|
||||
const namePrefix = packageJson('name')?.match(/^(@[^/]+)\//);
|
||||
if (namePrefix) {
|
||||
scope = namePrefix[1];
|
||||
}
|
||||
}
|
||||
if (scope && scope[0] != '@') {
|
||||
scope = '@' + scope;
|
||||
}
|
||||
@@ -57,3 +63,14 @@ function writeRegistryToFile(
|
||||
process.env.NODE_AUTH_TOKEN || 'XXXXX-XXXXX-XXXXX-XXXXX'
|
||||
);
|
||||
}
|
||||
|
||||
function packageJson(prop: string){
|
||||
const pkgPath: string = path.resolve(process.env['RUNNER_TEMP'] || process.cwd(), 'package.json');
|
||||
try {
|
||||
const json = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
||||
|
||||
return prop ? json[prop] : json;
|
||||
} catch(e) {
|
||||
core.debug(`Unable to read from package.json`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user