MCPcopy
hub / github.com/github/github-mcp-server / FetchRepoIsPrivate

Function FetchRepoIsPrivate

pkg/github/repositories.go:685–694  ·  view source on GitHub ↗

FetchRepoIsPrivate returns whether a repository is private. It is a thin wrapper around the GitHub Repositories.Get endpoint provided as a shared helper for IFC label computation across tools.

(ctx context.Context, client *github.Client, owner, repo string)

Source from the content-addressed store, hash-verified

683// wrapper around the GitHub Repositories.Get endpoint provided as a shared
684// helper for IFC label computation across tools.
685func FetchRepoIsPrivate(ctx context.Context, client *github.Client, owner, repo string) (bool, error) {
686 r, resp, err := client.Repositories.Get(ctx, owner, repo)
687 if resp != nil {
688 defer func() { _ = resp.Body.Close() }()
689 }
690 if err != nil {
691 return false, err
692 }
693 return r.GetPrivate(), nil
694}
695
696// GetFileContents creates a tool to get the contents of a file or directory from a GitHub repository.
697func GetFileContents(t translations.TranslationHelperFunc) inventory.ServerTool {

Callers 3

Calls 1

CloseMethod · 0.80

Tested by

no test coverage detected