Skip to content

Commit

Permalink
feat: support custom url for node download
Browse files Browse the repository at this point in the history
  • Loading branch information
asjdf committed Jul 23, 2024
1 parent 26961cf commit 07d27ac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: 'Setup Node.js environment'
description: 'Setup a Node.js environment by adding problem matchers and optionally downloading and adding it to the PATH.'
author: 'GitHub'
inputs:
custom-url:
description: 'Custom url for Node download.'
always-auth:
description: 'Set always-auth in npmrc.'
default: 'false'
Expand Down
6 changes: 5 additions & 1 deletion dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93860,7 +93860,11 @@ class BaseDistribution {
: `${fileName}.7z`
: `${fileName}.tar.gz`;
const initialUrl = this.getDistributionUrl();
const url = `${initialUrl}/v${version}/${urlFileName}`;
let url = `${initialUrl}/v${version}/${urlFileName}`;
const customUrl = core.getInput('custom-url');
if (customUrl) {
url = customUrl;
}
return {
downloadUrl: url,
resolvedVersion: version,
Expand Down
7 changes: 6 additions & 1 deletion src/distributions/base-distribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ export default abstract class BaseDistribution {
: `${fileName}.7z`
: `${fileName}.tar.gz`;
const initialUrl = this.getDistributionUrl();
const url = `${initialUrl}/v${version}/${urlFileName}`;
let url = `${initialUrl}/v${version}/${urlFileName}`;

const customUrl = core.getInput('custom-url');
if (customUrl){
url = customUrl;
}

return <INodeVersionInfo>{
downloadUrl: url,
Expand Down

0 comments on commit 07d27ac

Please sign in to comment.