diff --git a/runbot/runbot.py b/runbot/runbot.py index 6bff170a..1649c3af 100644 --- a/runbot/runbot.py +++ b/runbot/runbot.py @@ -1250,15 +1250,13 @@ def hook(self, repo_id=None, **post): repo_data = request.jsonrequest.get('repository') event = request.httprequest.headers.get("X-Github-Event") if repo_data and event in ['push', 'pull_request']: - repo_owner = repo_data['owner'].get('name') or repo_data['owner'].get('login') - repo_name = repo_data['name'] repo_domain = [ - '|', ('name', '=', 'git@github.com:%s/%s.git' % (repo_owner, repo_name)), - ('name', '=', 'https://github.com/%s/%s.git' % (repo_owner, repo_name)), + '|', ('name', '=', repo_data['repository']['ssh_url']), + ('name', '=', repo_data['repository']['clone_url']), ] repo = request.registry['runbot.repo'].search( request.cr, SUPERUSER_ID, repo_domain, limit=1) - repo_id = repo[0] if len(repo) else None + repo_id = repo[0] if repo else None if repo_id: repo = request.registry['runbot.repo'].browse(request.cr, SUPERUSER_ID, [repo_id])