webhooks.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:repository-gardener 作者: GoogleCloudPlatform 项目源码 文件源码
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(al|es)|happy|satisfied)'
    ci_tool = r'\b(travis|tests|statuses)\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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号