Skip to content

Issue Listing Private Repositories for User #2980

Description

@untamed-theory

I am attempting to list all repositories (private and public) for an installed GitHub app using the client.Repositories.List() function.

Problem: It is only returning public repositories. Not private ones, which the app has permission to access.

tr := http.DefaultTransport

//using ghinstallation for auth
itr, err := ghinstallation.NewKeyFromFile(tr, viper.GetInt64("APP_ID"), installationid, viper.GetString("KEY_PATH"))
if err != nil {
	log.Fatal("Error Generating new GitHub key from file: ", err)
}

client := github.NewClient(&http.Client{Transport: itr})

// Make the call to list repositories
opt := &github.RepositoryListOptions{Type: "all"}
orgs, resp, err = newclient.Repositories.List(ctx, p.Org, opt)

I have even tried the following:

  • using .WithAuthToken() instead of ghinstallation library
  • Using the token to make a raw HTTP call, not using the go-github library.

No matter what, it won't return private repos in the list. Could it be a GitHub API problem? The Installation token that is generated is legitimate, and actually allows me to clone repositories.

Any help would be massively appreciated. I feel like I'm taking crazy pills 😆

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions