api.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:invenio-github 作者: inveniosoftware 项目源码 文件源码
def sync_repo_hook(self, repo_id):
        """Sync a GitHub repo's hook with the locally stored repo."""
        # Get the hook that we may have set in the past
        gh_repo = self.api.repository_with_id(repo_id)
        hooks = (hook.id for hook in gh_repo.hooks()
                 if hook.config.get('url', '') == self.webhook_url)
        hook_id = next(hooks, None)

        # If hook on GitHub exists, get or create corresponding db object and
        # enable the hook. Otherwise remove the old hook information.
        if hook_id:
            Repository.enable(user_id=self.user_id,
                              github_id=gh_repo.id,
                              name=gh_repo.full_name,
                              hook=hook_id)
        else:
            Repository.disable(user_id=self.user_id,
                               github_id=gh_repo.id,
                               name=gh_repo.full_name)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号