Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency in behavior of repo Private field when editing repo #2828

Open
murphyke opened this issue Jul 6, 2023 · 2 comments
Open

Inconsistency in behavior of repo Private field when editing repo #2828

murphyke opened this issue Jul 6, 2023 · 2 comments

Comments

@murphyke
Copy link

murphyke commented Jul 6, 2023

Using github.com/google/go-github/v53 v53.2.0 against GitHub Enterprise Server 3.5.5, the following code was able to convert public repositories to private, but it did nothing in the case of internal repositories (there was no error, and the visibility level was unchanged):

	_, _, err := client.Repositories.Edit(ctx, *repo.Owner.Login, *repo.Name, &github.Repository{
		Private: github.Bool(true),
	})

In contrast, the alternative approach of setting the Visibility attribute to private worked for both public and internal repositories:

	_, _, err := client.Repositories.Edit(ctx, *repo.Owner.Login, *repo.Name, &github.Repository{
		Visibility: github.String("private"),
	})

go version go1.20.4 darwin/amd64

@gmlewis
Copy link
Collaborator

gmlewis commented Jul 6, 2023

Hmmm... you might prefer to contact GitHub v3 API technical support to report the inconsistency of behavior, as this is simply a client repo that makes it easier to make calls into the GitHub v3 API.

Please feel free to report back here what you find out from the official tech support team.

@murphyke
Copy link
Author

murphyke commented Jul 7, 2023

OK, thanks, I kind of assumed that that sort of inconsistency would be unlikely to have persisted in the GitHub API, and I am too lazy to test the REST API directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants