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)
| 683 | // wrapper around the GitHub Repositories.Get endpoint provided as a shared |
| 684 | // helper for IFC label computation across tools. |
| 685 | func 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. |
| 697 | func GetFileContents(t translations.TranslationHelperFunc) inventory.ServerTool { |
no test coverage detected