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

Use core.getBooleanInput() to resolve include-prerelease option #250

Merged
merged 3 commits into from Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions __tests__/setup-dotnet.test.ts
Expand Up @@ -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';
nogic1008 marked this conversation as resolved.
Show resolved Hide resolved
await io.rmRF(toolDir);
await io.rmRF(tempDir);
});
Expand Down
1 change: 1 addition & 0 deletions action.yml
Expand Up @@ -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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remove single quotes ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmitry-shibanov
GitHub Action schema warns this should be string. Should I still remove the quotes?
Incorrect type. Expected "string".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be okay, because we use the similar approach for setup-node https://github.com/actions/setup-node/blob/main/action.yml#L16. But I think you can keep this variant due to the parsing logic of runner.

runs:
using: 'node16'
main: 'dist/index.js'
3 changes: 1 addition & 2 deletions dist/index.js
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/setup-dotnet.ts
Expand Up @@ -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<string>(versions)) {
dotnetInstaller = new installer.DotnetCoreInstaller(
Expand Down