Skip to content

Reject invalid boolean input values - #1160

Merged
brunoborges merged 1 commit into
actions:mainfrom
brunoborges:brunoborges-reject-invalid-boolean-inputs
Jul 29, 2026
Merged

Reject invalid boolean input values#1160
brunoborges merged 1 commit into
actions:mainfrom
brunoborges:brunoborges-reject-invalid-boolean-inputs

Conversation

@brunoborges

Copy link
Copy Markdown
Contributor

Description:
Boolean input typos currently fall through as false, which can silently disable requested behavior. This change makes the shared parser accept only case-insensitive true or false, preserves existing defaults and whitespace handling, and reports the input name and invalid value for unsupported values.

The stricter behavior applies consistently to all seven boolean inputs that use the helper. The checked-in setup and cleanup bundles are rebuilt to match the TypeScript source.

Related issue:
Fixes: #1157

Check list:

  • Ran npm run check locally (format, lint, build, test) and all checks pass.
  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c6daa6b5-31f5-46b2-a994-b8320b50a50d
Copilot AI review requested due to automatic review settings July 29, 2026 02:30
@brunoborges
brunoborges requested a review from a team as a code owner July 29, 2026 02:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens boolean input parsing in actions/setup-java so typos like ture no longer silently evaluate as false, aligning behavior with the linked issue (#1157) and improving input validation consistency across the action.

Changes:

  • Updated the shared getBooleanInput helper to accept only case-insensitive true/false, preserve default handling, and throw a descriptive error on invalid values.
  • Rebuilt the checked-in dist/setup and dist/cleanup bundles to reflect the TypeScript change.
  • Added unit tests covering casing, whitespace, defaults, and invalid values across the seven boolean inputs.
Show a summary per file
File Description
src/util.ts Implements strict boolean parsing and improved validation error reporting.
dist/setup/index.js Rebuilt bundle reflecting the updated boolean parsing logic.
dist/cleanup/index.js Rebuilt bundle reflecting the updated boolean parsing logic.
tests/util.test.ts Adds test coverage for valid/invalid boolean inputs, casing, whitespace, and defaults.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/4 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread src/util.ts
@brunoborges
brunoborges merged commit ce75feb into actions:main Jul 29, 2026
439 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reject invalid values for boolean inputs

2 participants