def create_webhooks(self): for repo in self.objects: try: gh_repo = gh.repository(*repo.name.split('/')) name = 'web' config = { 'url': server_url + '/github/event_handler', 'content_type': 'json' } gh_repo.create_hook(name, config, events=['push', 'pull_request']) except Exception as ex: print('Failed to create webhook for: ' + repo.name) print(ex.errors)
def update_commit_status(repo_name, sha, state, description, context): repo = gh.repository(*repo_name.split('/')) repo.create_status(sha=sha, state=state, description=description, context=context)