Merge pull request #250 from nogic1008/refactor/boolean-input
Use `core.getBooleanInput()` to resolve `include-prerelease` option
This commit is contained in:
commit
37b00c4fc5
|
@ -16,6 +16,7 @@ describe('setup-dotnet tests', () => {
|
||||||
process.env.RUNNER_TOOL_CACHE = toolDir;
|
process.env.RUNNER_TOOL_CACHE = toolDir;
|
||||||
process.env.DOTNET_INSTALL_DIR = toolDir;
|
process.env.DOTNET_INSTALL_DIR = toolDir;
|
||||||
process.env.RUNNER_TEMP = tempDir;
|
process.env.RUNNER_TEMP = tempDir;
|
||||||
|
process.env['INPUT_INCLUDE-PRERELEASE'] = 'false';
|
||||||
await io.rmRF(toolDir);
|
await io.rmRF(toolDir);
|
||||||
await io.rmRF(tempDir);
|
await io.rmRF(tempDir);
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,6 +18,7 @@ inputs:
|
||||||
include-prerelease:
|
include-prerelease:
|
||||||
description: 'Whether prerelease versions should be matched with non-exact versions (for example 5.0.0-preview.6 being matched by 5, 5.0, 5.x or 5.0.x). Defaults to false if not provided.'
|
description: 'Whether prerelease versions should be matched with non-exact versions (for example 5.0.0-preview.6 being matched by 5, 5.0, 5.x or 5.0.x). Defaults to false if not provided.'
|
||||||
required: False
|
required: False
|
||||||
|
default: 'false'
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|
|
@ -478,8 +478,7 @@ function run() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (versions.length) {
|
if (versions.length) {
|
||||||
const includePrerelease = (core.getInput('include-prerelease') || 'false').toLowerCase() ===
|
const includePrerelease = core.getBooleanInput('include-prerelease');
|
||||||
'true';
|
|
||||||
let dotnetInstaller;
|
let dotnetInstaller;
|
||||||
for (const version of new Set(versions)) {
|
for (const version of new Set(versions)) {
|
||||||
dotnetInstaller = new installer.DotnetCoreInstaller(version, includePrerelease);
|
dotnetInstaller = new installer.DotnetCoreInstaller(version, includePrerelease);
|
||||||
|
|
|
@ -38,9 +38,9 @@ export async function run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (versions.length) {
|
if (versions.length) {
|
||||||
const includePrerelease: boolean =
|
const includePrerelease: boolean = core.getBooleanInput(
|
||||||
(core.getInput('include-prerelease') || 'false').toLowerCase() ===
|
'include-prerelease'
|
||||||
'true';
|
);
|
||||||
let dotnetInstaller!: installer.DotnetCoreInstaller;
|
let dotnetInstaller!: installer.DotnetCoreInstaller;
|
||||||
for (const version of new Set<string>(versions)) {
|
for (const version of new Set<string>(versions)) {
|
||||||
dotnetInstaller = new installer.DotnetCoreInstaller(
|
dotnetInstaller = new installer.DotnetCoreInstaller(
|
||||||
|
|
Loading…
Reference in New Issue