Skip to content

Commit

Permalink
[REF] Use of ssh_url and clone_url instead of repo/owner
Browse files Browse the repository at this point in the history
  • Loading branch information
moylop260 committed Nov 21, 2015
1 parent 99ba9e2 commit 68f8bb4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions runbot/runbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 68f8bb4

Please sign in to comment.