Skip to content

Not able to get private repo information #1382

Closed
@palash25

Description

@palash25

Hi I am trying to fetch all the repos (including private ones) including their PRs and Reviews. I am authenticating using my personal access token that has SSO enabled for the organization whose repos I want to fetch. But for some reason it only works for public repos and I dont see any private repos in my results

Here is the code

        ctx := context.Background()
	ts := oauth2.StaticTokenSource(
		&oauth2.Token{AccessToken: "my-token"},
	)
	tc := oauth2.NewClient(ctx, ts)

	client := github.NewClient(tc)

       prs, _, err := client.PullRequests.List(ctx, "org-name", "private-repo-name", nil)
	checkErr(err)

	for _, pr := range prs {
		fmt.Println(*pr.Title)
	}

I get an error saying GET https://api.github.com/repos/org-name/private-repo-name/pulls: 404 Not Found [] if I try to fetch the PRs of a private repo from that org

If however, I try a public repo it works.

I am able to access these repos on github

Am I authenticating my client correctly?

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