fix(validate-inputs): add logic to skip undefined empty (#311)

* fix(validate-inputs): add logic to skip undefined empty

* chore: code review comments
This commit is contained in:
2025-10-26 23:52:47 +02:00
committed by GitHub
parent 81f54fda92
commit e2222afff1

View File

@@ -285,6 +285,8 @@ class ConventionBasedValidator(BaseValidator):
# Get conventions and overrides from rules
conventions = self._rules.get("conventions", {})
overrides = self._rules.get("overrides", {})
optional_inputs = self._rules.get("optional_inputs", {})
required_inputs = self.get_required_inputs()
# Validate each input
for input_name, value in inputs.items():
@@ -292,12 +294,28 @@ class ConventionBasedValidator(BaseValidator):
if input_name in overrides and overrides[input_name] is None:
continue
# Check if input is defined in the action's rules
is_defined_input = (
input_name in required_inputs
or input_name in optional_inputs
or input_name in conventions
or input_name in overrides
)
# Skip validation for undefined inputs with empty values
# This prevents auto-validation of irrelevant inputs from the
# validate-inputs action's own input list
if not is_defined_input and (
not value or (isinstance(value, str) and not value.strip())
):
continue
# Get validator type from overrides or conventions
validator_type = self._get_validator_type(input_name, conventions, overrides)
if validator_type:
# Check if this is a required input
is_required = input_name in self.get_required_inputs()
is_required = input_name in required_inputs
valid &= self._apply_validator(
input_name, value, validator_type, is_required=is_required
)