예제 #1
0
def issue_comment(payload):
    """Responds to 'issue_comment' events."""
    try:
        body = payload['issue']['body']
        comments_url = payload['issue']['comments_url']
        pull_request_url = payload['issue']['pull_request']['url']
    except KeyError:
        return 'Bad Request', 400

    return get_instance(pull_request_url, comments_url, body).review()
예제 #2
0
def pull_request(payload):
    """Responds to 'pull_request' events."""
    try:
        action = payload['action']
        pull_request_url = payload['pull_request']['url']
        body = payload['pull_request']['body']
        comments_url = payload['pull_request']['comments_url']
    except KeyError:
        return 'Bad Request', 400

    if action not in ['opened', 'reopened']:
        return 'Nothing to do', 200

    return get_instance(pull_request_url, comments_url, body).review()