import re


def extract_pull_request_number(commit_logs):
    """Extract first occurrence of pull request number from commit logs.

    :param str commit_logs: oneline commit logs

    :return: pull request number
    :rtype: str
    """
    m = re.search(r'pull request #(\d+)', commit_logs)
    if not m:
        raise Exception(
            'cannot detect pull request number from\n{}'.format(commit_logs))
    return m.group(1)