go-github
go-github copied to clipboard
Inconsistency in behavior of repo Private field when editing repo
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
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.
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.