def check_for_auto_merge_trigger()

in webhook-app/webhooks.py [0:0]


def check_for_auto_merge_trigger(text):
    """Checks the text for the phrases that should trigger an automerge."""
    # The comment must address @dpebot directly, on the same line
    comment = re.search(
        r'@{}\s+\b(.+)'.format(github_helper.github_user()), text, re.I)
    if not comment:
        return False
    else:
        # Just get the meat of the command
        comment = comment.group(1).strip()

    satisfaction = r'\b(pass|passes|green|approv(e|al|es|ed)|happy|satisfied)'
    ci_tool = r'\b(travis|tests|statuses|kokoro|ci)\b'
    merge_action = r'\bmerge\b'
    triggers = (
        r'{}.+({}.+)?{}'.format(merge_action, ci_tool, satisfaction),
        r'{}.+{},.+{}'.format(ci_tool, satisfaction, merge_action),
        'lgtm',
    )

    return any(re.search(trigger, comment, re.I) for trigger in triggers)