Skip to content

Commit

Permalink
Add the addFeed optional input to the nbgv Action
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Aug 12, 2022
1 parent 36827c1 commit 4ae2ce4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ All inputs are optional.
`setAllVars`|false|Defines ALL version variables as environment variables, with a "NBGV_" prefix. Adds the `--all-vars` switch to the `nbgv cloud` command.
`stamp`||The path to a file whose version setting should be changed to match the computed version. Supported file types: `package.json`
`toolVersion`|latest stable|The version of the nbgv dotnet CLI tool to install and use. If not specified, the default is the latest stable version.
`toolFeed`|nuget.config content|An additional feed to search for the nbgv dotnet CLI tool. Default feeds may include https://api.nuget.org/v3/index.json or whatever is specified in a nuget.config file at the root of your repo.

## Outputs

Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ inputs:
toolVersion:
description: The version of the nbgv dotnet CLI tool to install and use. If not specified, the default is the latest stable version.
required: false
toolFeed:
description: An additional feed to search for the nbgv dotnet CLI tool. Default feeds may include https://api.nuget.org/v3/index.json or whatever is specified in a nuget.config file at the root of your repo.
required: false
outputs:
CloudBuildNumber:
description: The cloud build number
Expand Down
7 changes: 7 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,9 @@ async function run() {
if (settings_1.Inputs.toolVersion) {
installArgs.push('--version', settings_1.Inputs.toolVersion);
}
if (settings_1.Inputs.toolFeed) {
installArgs.push('--add-source', settings_1.Inputs.toolFeed);
}
let exitCode = await exec_1.exec('dotnet', installArgs, { ignoreReturnCode: true });
if (exitCode > 1) {
throw new Error("dotnet tool install failed.");
Expand Down Expand Up @@ -1510,6 +1513,10 @@ class Inputs {
const result = core.getInput('toolVersion');
return result === '' || result === null ? undefined : result;
}
static get toolFeed() {
const result = core.getInput('toolFeed');
return result === '' || result === null ? undefined : result;
}
}
exports.Inputs = Inputs;

Expand Down
4 changes: 4 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ async function run() {
installArgs.push('--version', Inputs.toolVersion);
}

if (Inputs.toolFeed) {
installArgs.push('--add-source', Inputs.toolFeed);
}

let exitCode = await exec('dotnet', installArgs, { ignoreReturnCode: true });
if (exitCode > 1) {
throw new Error("dotnet tool install failed.");
Expand Down
5 changes: 5 additions & 0 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ export class Inputs {
const result = core.getInput('toolVersion');
return result === '' || result === null ? undefined : result;
}

static get toolFeed(): string | undefined {
const result = core.getInput('toolFeed');
return result === '' || result === null ? undefined : result;
}
}

0 comments on commit 4ae2ce4

Please sign in to comment.