

def github_hgrid_data(node_settings, auth, **kwargs):
    if (not node_settings.complete):
        return
    connection = GitHubClient(external_account=node_settings.external_account)
    repo = None
    node = node_settings.owner
    if (node.is_public and (not node.is_contributor(auth.user))):
        try:
            repo = connection.repo(node_settings.user, node_settings.repo)
        except NotFoundError:
            logger.error('Could not access GitHub repo')
            return None
        if repo.private:
            return None
    try:
        (branch, sha, branches) = get_refs(node_settings, branch=kwargs.get('branch'), sha=kwargs.get('sha'), connection=connection)
    except (NotFoundError, GitHubError):
        logger.error('GitHub repo not found')
        return
    if (branch is not None):
        ref = ref_to_params(branch, sha)
        can_edit = check_permissions(node_settings, auth, connection, auth, sha, repo=repo)
    else:
        ref = None
        can_edit = False
    name_tpl = '{user}/{repo}'.format(user=node_settings.user, repo=node_settings.repo)
    permissions = {
        'edit': can_edit,
        'view': True,
        'private': node_settings.is_private,
    }
    urls = {
        'upload': ((node_settings.owner.api_url + 'github/file/') + (ref or '')),
        'fetch': ((node_settings.owner.api_url + 'github/hgrid/') + (ref or '')),
        'branch': (node_settings.owner.api_url + 'github/hgrid/root/'),
        'zip': ((node_settings.owner.api_url + 'github/zipball/') + (ref or '')),
        'repo': 'https://github.com/{0}/{1}/tree/{2}'.format(node_settings.user, node_settings.repo, branch),
    }
    branch_names = [each.name for each in branches]
    if (not branch_names):
        branch_names = [branch]
    return [rubeus.build_addon_root(node_settings, name_tpl, urls=urls, permissions=permissions, branches=branch_names, defaultBranch=branch)]

dataset/ETHPy150Open CenterForOpenScience/osf.io/website/addons/github/views.py github_hgrid_data/VarMisuse@206/278 `branch`->`auth`