Remove dummy NODE_AUTH_TOKEN export (#1558)
Some checks are pending
Basic validation / Basic validation (push) Waiting to run
Check dist / Check dist/ (push) Waiting to run
CodeQL analysis / CodeQL analysis (push) Waiting to run
e2e-cache / Test npm (Node 20, macos-latest) (push) Waiting to run
e2e-cache / Test npm (Node 20, macos-latest-large) (push) Waiting to run
e2e-cache / Test npm (Node 20, ubuntu-latest) (push) Waiting to run
e2e-cache / Test npm (Node 20, windows-latest) (push) Waiting to run
e2e-cache / Test npm (Node 22, macos-latest) (push) Waiting to run
e2e-cache / Test npm (Node 22, macos-latest-large) (push) Waiting to run
e2e-cache / Test npm (Node 22, ubuntu-latest) (push) Waiting to run
e2e-cache / Test npm (Node 22, windows-latest) (push) Waiting to run
e2e-cache / Test npm (Node 24, macos-latest) (push) Waiting to run
e2e-cache / Test npm (Node 24, macos-latest-large) (push) Waiting to run
e2e-cache / Test npm (Node 24, ubuntu-latest) (push) Waiting to run
e2e-cache / Test npm (Node 24, windows-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 20, macos-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 20, macos-latest-large) (push) Waiting to run
e2e-cache / Test pnpm (Node 20, ubuntu-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 20, windows-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 22, macos-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 22, macos-latest-large) (push) Waiting to run
e2e-cache / Test pnpm (Node 22, ubuntu-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 22, windows-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 24, macos-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 24, macos-latest-large) (push) Waiting to run
e2e-cache / Test pnpm (Node 24, ubuntu-latest) (push) Waiting to run
e2e-cache / Test pnpm (Node 24, windows-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 20, macos-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 20, macos-latest-large) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 20, ubuntu-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 20, windows-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 22, macos-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 22, macos-latest-large) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 22, ubuntu-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 22, windows-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 24, macos-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 24, macos-latest-large) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 24, ubuntu-latest) (push) Waiting to run
e2e-cache / Test yarn 1 (Node 24, windows-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 20, macos-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 20, macos-latest-large) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 20, ubuntu-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 20, windows-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 22, macos-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 22, macos-latest-large) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 22, ubuntu-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 22, windows-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 24, macos-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 24, macos-latest-large) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 24, ubuntu-latest) (push) Waiting to run
e2e-cache / Test yarn 3 (Node 24, windows-latest) (push) Waiting to run
e2e-cache / Test yarn subprojects (20) (push) Waiting to run
e2e-cache / Test yarn subprojects (22) (push) Waiting to run
e2e-cache / Test yarn subprojects (24) (push) Waiting to run
e2e-cache / Test yarn subprojects all locally managed (20) (push) Waiting to run
e2e-cache / Test yarn subprojects all locally managed (22) (push) Waiting to run
e2e-cache / Test yarn subprojects all locally managed (24) (push) Waiting to run
e2e-cache / Test yarn subprojects some locally managed (20) (push) Waiting to run
e2e-cache / Test yarn subprojects some locally managed (22) (push) Waiting to run
e2e-cache / Test yarn subprojects some locally managed (24) (push) Waiting to run
e2e-cache / Test yarn subprojects managed by git (20) (push) Waiting to run
e2e-cache / Test yarn subprojects managed by git (22) (push) Waiting to run
e2e-cache / Test yarn subprojects managed by git (24) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (20, macos-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (20, macos-latest-large) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (20, ubuntu-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (20, windows-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (22, macos-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (22, macos-latest-large) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (22, ubuntu-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (22, windows-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (24, macos-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (24, macos-latest-large) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (24, ubuntu-latest) (push) Waiting to run
e2e-cache / Test auto cache with top-level packageManager (24, windows-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (20, macos-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (20, macos-latest-large) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (20, ubuntu-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (20, windows-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (22, macos-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (22, macos-latest-large) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (22, ubuntu-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (22, windows-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (24, macos-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (24, macos-latest-large) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (24, ubuntu-latest) (push) Waiting to run
e2e-cache / Test auto cache with devEngines.packageManager (24, windows-latest) (push) Waiting to run
Licensed / Licensed (push) Waiting to run
proxy / test-proxy (push) Waiting to run
proxy / test-bypass-proxy (push) Waiting to run
versions / local-cache (20, macos-latest) (push) Waiting to run
versions / local-cache (20, macos-latest-large) (push) Waiting to run
versions / local-cache (20, ubuntu-latest) (push) Waiting to run
versions / local-cache (20, windows-latest) (push) Waiting to run
versions / local-cache (22, macos-latest) (push) Waiting to run
versions / local-cache (22, macos-latest-large) (push) Waiting to run
versions / local-cache (22, ubuntu-latest) (push) Waiting to run
versions / local-cache (22, windows-latest) (push) Waiting to run
versions / local-cache (24, macos-latest) (push) Waiting to run
versions / local-cache (24, macos-latest-large) (push) Waiting to run
versions / local-cache (24, ubuntu-latest) (push) Waiting to run
versions / local-cache (24, windows-latest) (push) Waiting to run
versions / lts-syntax (lts/*, macos-latest-large) (push) Waiting to run
versions / lts-syntax (lts/*, ubuntu-latest) (push) Waiting to run
versions / lts-syntax (lts/*, windows-latest) (push) Waiting to run
versions / lts-syntax (lts/-1, macos-latest-large) (push) Waiting to run
versions / lts-syntax (lts/-1, ubuntu-latest) (push) Waiting to run
versions / lts-syntax (lts/-1, windows-latest) (push) Waiting to run
versions / lts-syntax (lts/dubnium, macos-latest-large) (push) Waiting to run
versions / lts-syntax (lts/dubnium, ubuntu-latest) (push) Waiting to run
versions / lts-syntax (lts/dubnium, windows-latest) (push) Waiting to run
versions / lts-syntax (lts/erbium, macos-latest-large) (push) Waiting to run
versions / lts-syntax (lts/erbium, ubuntu-latest) (push) Waiting to run
versions / lts-syntax (lts/erbium, windows-latest) (push) Waiting to run
versions / lts-syntax (lts/fermium, macos-latest-large) (push) Waiting to run
versions / lts-syntax (lts/fermium, ubuntu-latest) (push) Waiting to run
versions / lts-syntax (lts/fermium, windows-latest) (push) Waiting to run
versions / v8-canary-syntax (20-v8-canary, macos-latest) (push) Waiting to run
versions / v8-canary-syntax (20-v8-canary, macos-latest-large) (push) Waiting to run
versions / v8-canary-syntax (20-v8-canary, ubuntu-latest) (push) Waiting to run
versions / v8-canary-syntax (20-v8-canary, windows-latest) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary, macos-latest) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary, macos-latest-large) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary, ubuntu-latest) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary, windows-latest) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary20221101e50e45c9f8, macos-latest) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary20221101e50e45c9f8, macos-latest-large) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary20221101e50e45c9f8, ubuntu-latest) (push) Waiting to run
versions / v8-canary-syntax (20.0.0-v8-canary20221101e50e45c9f8, windows-latest) (push) Waiting to run
versions / nightly-syntax (20-nightly, macos-latest) (push) Waiting to run
versions / nightly-syntax (20-nightly, macos-latest-large) (push) Waiting to run
versions / nightly-syntax (20-nightly, ubuntu-latest) (push) Waiting to run
versions / nightly-syntax (20-nightly, windows-latest) (push) Waiting to run
versions / nightly-syntax (24.0.0-nightly, macos-latest) (push) Waiting to run
versions / nightly-syntax (24.0.0-nightly, macos-latest-large) (push) Waiting to run
versions / nightly-syntax (24.0.0-nightly, ubuntu-latest) (push) Waiting to run
versions / nightly-syntax (24.0.0-nightly, windows-latest) (push) Waiting to run
versions / nightly-syntax (25-nightly, macos-latest) (push) Waiting to run
versions / nightly-syntax (25-nightly, macos-latest-large) (push) Waiting to run
versions / nightly-syntax (25-nightly, ubuntu-latest) (push) Waiting to run
versions / nightly-syntax (25-nightly, windows-latest) (push) Waiting to run
versions / rc-syntax (20.0.0-rc.1, macos-latest) (push) Waiting to run
versions / rc-syntax (20.0.0-rc.1, macos-latest-large) (push) Waiting to run
versions / rc-syntax (20.0.0-rc.1, ubuntu-latest) (push) Waiting to run
versions / rc-syntax (20.0.0-rc.1, windows-latest) (push) Waiting to run
versions / rc-syntax (22.14.0-rc.1, macos-latest) (push) Waiting to run
versions / rc-syntax (22.14.0-rc.1, macos-latest-large) (push) Waiting to run
versions / rc-syntax (22.14.0-rc.1, ubuntu-latest) (push) Waiting to run
versions / rc-syntax (22.14.0-rc.1, windows-latest) (push) Waiting to run
versions / rc-syntax (24.0.0-rc.4, macos-latest) (push) Waiting to run
versions / rc-syntax (24.0.0-rc.4, macos-latest-large) (push) Waiting to run
versions / rc-syntax (24.0.0-rc.4, ubuntu-latest) (push) Waiting to run
versions / rc-syntax (24.0.0-rc.4, windows-latest) (push) Waiting to run
versions / manifest (20.10.0, macos-latest) (push) Waiting to run
versions / manifest (20.10.0, macos-latest-large) (push) Waiting to run
versions / manifest (20.10.0, ubuntu-latest) (push) Waiting to run
versions / manifest (20.10.0, windows-latest) (push) Waiting to run
versions / manifest (22.0.0, macos-latest) (push) Waiting to run
versions / manifest (22.0.0, macos-latest-large) (push) Waiting to run
versions / manifest (22.0.0, ubuntu-latest) (push) Waiting to run
versions / manifest (22.0.0, windows-latest) (push) Waiting to run
versions / manifest (24.9.0, macos-latest) (push) Waiting to run
versions / manifest (24.9.0, macos-latest-large) (push) Waiting to run
versions / manifest (24.9.0, ubuntu-latest) (push) Waiting to run
versions / manifest (24.9.0, windows-latest) (push) Waiting to run
versions / check-latest (20, macos-latest) (push) Waiting to run
versions / check-latest (20, macos-latest-large) (push) Waiting to run
versions / check-latest (20, ubuntu-latest) (push) Waiting to run
versions / check-latest (20, windows-latest) (push) Waiting to run
versions / check-latest (22, macos-latest) (push) Waiting to run
versions / check-latest (22, macos-latest-large) (push) Waiting to run
versions / check-latest (22, ubuntu-latest) (push) Waiting to run
versions / check-latest (22, windows-latest) (push) Waiting to run
versions / check-latest (24, macos-latest) (push) Waiting to run
versions / check-latest (24, macos-latest-large) (push) Waiting to run
versions / check-latest (24, ubuntu-latest) (push) Waiting to run
versions / check-latest (24, windows-latest) (push) Waiting to run
versions / version-file (.nvmrc, macos-latest) (push) Waiting to run
versions / version-file (.nvmrc, macos-latest-large) (push) Waiting to run
versions / version-file (.nvmrc, ubuntu-latest) (push) Waiting to run
versions / version-file (.nvmrc, windows-latest) (push) Waiting to run
versions / version-file (.tool-versions, macos-latest) (push) Waiting to run
versions / version-file (.tool-versions, macos-latest-large) (push) Waiting to run
versions / version-file (.tool-versions, ubuntu-latest) (push) Waiting to run
versions / version-file (.tool-versions, windows-latest) (push) Waiting to run
versions / version-file (.tool-versions-node, macos-latest) (push) Waiting to run
versions / version-file (.tool-versions-node, macos-latest-large) (push) Waiting to run
versions / version-file (.tool-versions-node, ubuntu-latest) (push) Waiting to run
versions / version-file (.tool-versions-node, windows-latest) (push) Waiting to run
versions / version-file (package.json, macos-latest) (push) Waiting to run
versions / version-file (package.json, macos-latest-large) (push) Waiting to run
versions / version-file (package.json, ubuntu-latest) (push) Waiting to run
versions / version-file (package.json, windows-latest) (push) Waiting to run
versions / version-file-dev-engines (macos-latest) (push) Waiting to run
versions / version-file-dev-engines (ubuntu-latest) (push) Waiting to run
versions / version-file-dev-engines (windows-latest) (push) Waiting to run
versions / version-file-volta (macos-latest) (push) Waiting to run
versions / version-file-volta (macos-latest-large) (push) Waiting to run
versions / version-file-volta (ubuntu-latest) (push) Waiting to run
versions / version-file-volta (windows-latest) (push) Waiting to run
versions / version-file-volta-extends (macos-latest) (push) Waiting to run
versions / version-file-volta-extends (macos-latest-large) (push) Waiting to run
versions / version-file-volta-extends (ubuntu-latest) (push) Waiting to run
versions / version-file-volta-extends (windows-latest) (push) Waiting to run
versions / node-dist (21, macos-latest) (push) Waiting to run
versions / node-dist (21, macos-latest-large) (push) Waiting to run
versions / node-dist (21, ubuntu-latest) (push) Waiting to run
versions / node-dist (21, windows-latest) (push) Waiting to run
versions / node-dist (23, macos-latest) (push) Waiting to run
versions / node-dist (23, macos-latest-large) (push) Waiting to run
versions / node-dist (23, ubuntu-latest) (push) Waiting to run
versions / node-dist (23, windows-latest) (push) Waiting to run
versions / old-versions (macos-latest-large) (push) Waiting to run
versions / old-versions (ubuntu-latest) (push) Waiting to run
versions / old-versions (windows-latest) (push) Waiting to run
versions / arch (push) Waiting to run
versions / node-latest-aliases (current, macos-latest) (push) Waiting to run
versions / node-latest-aliases (current, macos-latest-large) (push) Waiting to run
versions / node-latest-aliases (current, ubuntu-latest) (push) Waiting to run
versions / node-latest-aliases (current, windows-latest) (push) Waiting to run
versions / node-latest-aliases (latest, macos-latest) (push) Waiting to run
versions / node-latest-aliases (latest, macos-latest-large) (push) Waiting to run
versions / node-latest-aliases (latest, ubuntu-latest) (push) Waiting to run
versions / node-latest-aliases (latest, windows-latest) (push) Waiting to run
versions / node-latest-aliases (node, macos-latest) (push) Waiting to run
versions / node-latest-aliases (node, macos-latest-large) (push) Waiting to run
versions / node-latest-aliases (node, ubuntu-latest) (push) Waiting to run
versions / node-latest-aliases (node, windows-latest) (push) Waiting to run

Co-authored-by: gowridurgad <gowridurgad@gmail.com>
This commit is contained in:
gowridurgad
2026-05-28 08:26:31 +05:30
committed by GitHub
parent ad1b57eb81
commit 0355742c94
3 changed files with 29 additions and 7 deletions

View File

@@ -118,6 +118,27 @@ describe('authutil tests', () => {
expect(process.env.NODE_AUTH_TOKEN).toEqual('foobar');
});
it('should not export NODE_AUTH_TOKEN if not set in environment', async () => {
const exportSpy = jest.spyOn(core, 'exportVariable');
delete process.env.NODE_AUTH_TOKEN;
await auth.configAuthentication('https://registry.npmjs.org/');
expect(fs.statSync(rcFile)).toBeDefined();
const rc = readRcFile(rcFile);
expect(rc['registry']).toBe('https://registry.npmjs.org/');
expect(exportSpy).not.toHaveBeenCalledWith(
'NODE_AUTH_TOKEN',
expect.anything()
);
});
it('should export NODE_AUTH_TOKEN if set to empty string', async () => {
const exportSpy = jest.spyOn(core, 'exportVariable');
process.env.NODE_AUTH_TOKEN = '';
await auth.configAuthentication('https://registry.npmjs.org/');
expect(fs.statSync(rcFile)).toBeDefined();
expect(exportSpy).toHaveBeenCalledWith('NODE_AUTH_TOKEN', '');
});
it('configAuthentication should overwrite non-scoped with non-scoped', async () => {
fs.writeFileSync(rcFile, 'registry=NNN');
await auth.configAuthentication('https://registry.npmjs.org/');

6
dist/setup/index.js vendored
View File

@@ -78875,8 +78875,10 @@ function writeRegistryToFile(registryUrl, fileLocation) {
newContents += `${authString}${os.EOL}${registryString}`;
fs.writeFileSync(fileLocation, newContents);
core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
// Export empty node_auth_token if didn't exist so npm doesn't complain about not being able to find it
core.exportVariable('NODE_AUTH_TOKEN', process.env.NODE_AUTH_TOKEN || 'XXXXX-XXXXX-XXXXX-XXXXX');
// Only export NODE_AUTH_TOKEN if explicitly provided by user
if (Object.prototype.hasOwnProperty.call(process.env, 'NODE_AUTH_TOKEN')) {
core.exportVariable('NODE_AUTH_TOKEN', process.env.NODE_AUTH_TOKEN);
}
}

View File

@@ -46,9 +46,8 @@ function writeRegistryToFile(registryUrl: string, fileLocation: string) {
newContents += `${authString}${os.EOL}${registryString}`;
fs.writeFileSync(fileLocation, newContents);
core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
// Export empty node_auth_token if didn't exist so npm doesn't complain about not being able to find it
core.exportVariable(
'NODE_AUTH_TOKEN',
process.env.NODE_AUTH_TOKEN || 'XXXXX-XXXXX-XXXXX-XXXXX'
);
// Only export NODE_AUTH_TOKEN if explicitly provided by user
if (Object.prototype.hasOwnProperty.call(process.env, 'NODE_AUTH_TOKEN')) {
core.exportVariable('NODE_AUTH_TOKEN', process.env.NODE_AUTH_TOKEN);
}
}