mirror of
https://github.com/actions/setup-java.git
synced 2026-07-30 09:10:01 +08:00
Reject invalid boolean input values (#1160)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c6daa6b5-31f5-46b2-a994-b8320b50a50d
This commit is contained in:
Vendored
+12
-1
@@ -97365,7 +97365,18 @@ function getTempDir() {
|
||||
return tempDirectory;
|
||||
}
|
||||
function util_getBooleanInput(inputName, defaultValue = false) {
|
||||
return ((core.getInput(inputName) || String(defaultValue)).toUpperCase() === 'TRUE');
|
||||
const inputValue = core.getInput(inputName);
|
||||
const normalizedValue = inputValue.trim().toLowerCase();
|
||||
if (!normalizedValue) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (normalizedValue === 'true') {
|
||||
return true;
|
||||
}
|
||||
if (normalizedValue === 'false') {
|
||||
return false;
|
||||
}
|
||||
throw new Error(`Invalid value '${inputValue}' for boolean input '${inputName}'. Expected 'true' or 'false'.`);
|
||||
}
|
||||
function getVersionFromToolcachePath(toolPath) {
|
||||
if (toolPath) {
|
||||
|
||||
Vendored
+12
-1
@@ -128364,7 +128364,18 @@ function getTempDir() {
|
||||
return tempDirectory;
|
||||
}
|
||||
function util_getBooleanInput(inputName, defaultValue = false) {
|
||||
return ((getInput(inputName) || String(defaultValue)).toUpperCase() === 'TRUE');
|
||||
const inputValue = getInput(inputName);
|
||||
const normalizedValue = inputValue.trim().toLowerCase();
|
||||
if (!normalizedValue) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (normalizedValue === 'true') {
|
||||
return true;
|
||||
}
|
||||
if (normalizedValue === 'false') {
|
||||
return false;
|
||||
}
|
||||
throw new Error(`Invalid value '${inputValue}' for boolean input '${inputName}'. Expected 'true' or 'false'.`);
|
||||
}
|
||||
function getVersionFromToolcachePath(toolPath) {
|
||||
if (toolPath) {
|
||||
|
||||
Reference in New Issue
Block a user