Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mirror-url parameter to allow downloading Node.js from a custom URL #1232

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
check failures fix
  • Loading branch information
aparnajyothi-y committed Feb 19, 2025
commit 07b84a232461e771afacc5ecf5a467c30d1ec024
1 change: 0 additions & 1 deletion __tests__/nightly-installer.test.ts
Original file line number Diff line number Diff line change
@@ -670,7 +670,6 @@ describe('NightlyNodejs', () => {
);
});

const core = require('@actions/core'); // Mock core
jest.spyOn(core, 'info').mockImplementation(() => {}); // Mock core.info function

it('logs mirror URL when provided', async () => {
2 changes: 1 addition & 1 deletion __tests__/rc-installer.test.ts
Original file line number Diff line number Diff line change
@@ -560,7 +560,7 @@ describe('setup-node', () => {
const infoSpy = jest.spyOn(core, 'info').mockImplementation(() => {});

// Expect the function to throw an error due to undefined mirror URL
expect(() => rcBuild.getDistributionMirrorUrl()).toThrowError(
expect(() => rcBuild.getDistributionMirrorUrl()).toThrow(
'Mirror URL is undefined. Please provide a valid mirror URL.'
);

3 changes: 1 addition & 2 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
@@ -100529,13 +100529,12 @@ class OfficialBuilds extends base_distribution_1.default {
throw new Error('Mirror URL is empty. Please provide a valid mirror URL.');
}
let downloadPath = '';
let toolPath = '';
try {
core.info(`Attempting to download using mirror URL...`);
downloadPath = yield this.downloadFromMirrorURL(); // Attempt to download from the mirror
core.info('downloadPath from downloadFromMirrorURL() ' + downloadPath);
if (downloadPath) {
toolPath = downloadPath;
const toolPath = downloadPath;
}
}
catch (err) {
1 change: 0 additions & 1 deletion src/distributions/nightly/nightly_builds.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import BasePrereleaseNodejs from '../base-distribution-prerelease';
import {NodeInputs} from '../base-models';
import * as core from '@actions/core';

export default class NightlyNodejs extends BasePrereleaseNodejs {
protected distribution = 'nightly';
4 changes: 2 additions & 2 deletions src/distributions/official_builds/official_builds.ts
Original file line number Diff line number Diff line change
@@ -22,13 +22,13 @@
);
}
let downloadPath = '';
let toolPath = '';

try {
core.info(`Attempting to download using mirror URL...`);
downloadPath = await this.downloadFromMirrorURL(); // Attempt to download from the mirror
core.info('downloadPath from downloadFromMirrorURL() ' + downloadPath);
if (downloadPath) {
toolPath = downloadPath;
const toolPath = downloadPath;

Check warning on line 31 in src/distributions/official_builds/official_builds.ts

GitHub Actions / Basic validation / build (macos-latest)

'toolPath' is assigned a value but never used

Check warning on line 31 in src/distributions/official_builds/official_builds.ts

GitHub Actions / Basic validation / build (windows-latest)

'toolPath' is assigned a value but never used

Check warning on line 31 in src/distributions/official_builds/official_builds.ts

GitHub Actions / Basic validation / build (ubuntu-latest)

'toolPath' is assigned a value but never used
}
} catch (err) {
core.info((err as Error).message);
1 change: 0 additions & 1 deletion src/distributions/rc/rc_builds.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import BaseDistribution from '../base-distribution';
import {NodeInputs} from '../base-models';
import * as core from '@actions/core';

export default class RcBuild extends BaseDistribution {
getDistributionMirrorUrl() {
Loading
Oops, something went wrong.