mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[FIX] runbot: allow to manually hook by calling route
This commit is contained in:
parent
daea9018d3
commit
10799ba9d6
@ -14,7 +14,7 @@ class RunbotHook(http.Controller):
|
||||
@http.route(['/runbot/hook/<int:repo_id>', '/runbot/hook/org'], type='http', auth="public", website=True, csrf=False)
|
||||
def hook(self, repo_id=None, **post):
|
||||
event = request.httprequest.headers.get("X-Github-Event")
|
||||
payload = json.loads(request.params['payload'])
|
||||
payload = json.loads(request.params.get('payload', '{}'))
|
||||
if repo_id is None:
|
||||
repo_data = payload.get('repository')
|
||||
if repo_data and event in ['push', 'pull_request']:
|
||||
@ -30,7 +30,7 @@ class RunbotHook(http.Controller):
|
||||
repo = request.env['runbot.repo'].sudo().browse([repo_id])
|
||||
|
||||
# force update of dependencies to in case a hook is lost
|
||||
if event == 'push' or (event == 'pull_request' and payload.get('action') in ('synchronize', 'opened', 'reopened')):
|
||||
if not payload or event == 'push' or (event == 'pull_request' and payload.get('action') in ('synchronize', 'opened', 'reopened')):
|
||||
(repo | repo.dependency_ids).write({'hook_time': time.time()})
|
||||
else:
|
||||
_logger.debug('Ignoring unsupported hook %s %s', event, payload.get('action', ''))
|
||||
|
Loading…
Reference in New Issue
Block a user