from typing import Union


def search_row(file_name: str, string: str) -> Union[int, None]:
    """Searches a file for the first row containing a string and returns the row index.
    If no match is found returns None.

    Args:
        file_name: path to file
        string: substring to find

    Returns:
        int: first row containing substring
    """
    with open(file_name, "r") as f:
        for i, row in enumerate(f):
            if string in row:
                return i
    return None