from typing import Optional
from typing import List
from typing import Dict


def all_checks_passed(runs: Optional[List[Dict]]) -> Optional[bool]:
    """
    check whether all checks from a PR head ref have completed and passed
    """
    if runs is None:
        return None
    for c in runs:
        if c['status'] == 'completed':
            if c['conclusion'] == 'failure':
                return False
        else:
            return None
    return True