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:
Bruno Borges
2026-07-28 22:43:39 -04:00
committed by GitHub
parent 382d4b753d
commit ce75feb3d3
4 changed files with 104 additions and 5 deletions
+15 -2
View File
@@ -20,8 +20,21 @@ export function getTempDir() {
}
export function getBooleanInput(inputName: string, 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'.`
);
}