from typing import Optional


def _is_action_required(user_value: Optional[bool], default_value: bool) -> bool:
    """
    Returns whether an action needs to be done, based on whether the user required it and the default value of the
    runner.
    """
    if user_value is True:
        # User required the action.
        return True
    elif user_value is False:
        # User required the action not to be taken.
        return False
    else:
        # User did not define whether the action needs to be done, use the default.
        return default_value