From ba5e53c61d7c39e7733cdefda3a45f96b5ec0db4 Mon Sep 17 00:00:00 2001 From: Nogic <24802730+nogic1008@users.noreply.github.com> Date: Wed, 24 Nov 2021 09:08:35 +0900 Subject: [PATCH 1/3] refactor: use core.getBooleanInput() --- dist/index.js | 3 +-- src/setup-dotnet.ts | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dist/index.js b/dist/index.js index 1ef7203b2..d897c56a4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -478,8 +478,7 @@ function run() { } } if (versions.length) { - const includePrerelease = (core.getInput('include-prerelease') || 'false').toLowerCase() === - 'true'; + const includePrerelease = core.getBooleanInput('include-prerelease'); let dotnetInstaller; for (const version of new Set(versions)) { dotnetInstaller = new installer.DotnetCoreInstaller(version, includePrerelease); diff --git a/src/setup-dotnet.ts b/src/setup-dotnet.ts index 64f314911..2ae04599e 100644 --- a/src/setup-dotnet.ts +++ b/src/setup-dotnet.ts @@ -38,9 +38,9 @@ export async function run() { } if (versions.length) { - const includePrerelease: boolean = - (core.getInput('include-prerelease') || 'false').toLowerCase() === - 'true'; + const includePrerelease: boolean = core.getBooleanInput( + 'include-prerelease' + ); let dotnetInstaller!: installer.DotnetCoreInstaller; for (const version of new Set(versions)) { dotnetInstaller = new installer.DotnetCoreInstaller( From c5267f5e54b2cc875fa47dca679c1771f95d5abd Mon Sep 17 00:00:00 2001 From: Nogic <24802730+nogic1008@users.noreply.github.com> Date: Wed, 24 Nov 2021 09:12:08 +0900 Subject: [PATCH 2/3] chore: set include-prerelease to false on default --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 3c0ecb0b0..0405e1c06 100644 --- a/action.yml +++ b/action.yml @@ -18,6 +18,7 @@ inputs: 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.' required: False + default: 'false' runs: using: 'node16' main: 'dist/index.js' From c2dac7f3675d6dc861cd7705d30a4bd3133ca98b Mon Sep 17 00:00:00 2001 From: Nogic <24802730+nogic1008@users.noreply.github.com> Date: Wed, 24 Nov 2021 09:12:51 +0900 Subject: [PATCH 3/3] test: add include-prerelease env on test --- __tests__/setup-dotnet.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/__tests__/setup-dotnet.test.ts b/__tests__/setup-dotnet.test.ts index 7ad8be8ff..aa8e380ef 100644 --- a/__tests__/setup-dotnet.test.ts +++ b/__tests__/setup-dotnet.test.ts @@ -16,6 +16,7 @@ describe('setup-dotnet tests', () => { process.env.RUNNER_TOOL_CACHE = toolDir; process.env.DOTNET_INSTALL_DIR = toolDir; process.env.RUNNER_TEMP = tempDir; + process.env['INPUT_INCLUDE-PRERELEASE'] = 'false'; await io.rmRF(toolDir); await io.rmRF(tempDir); });