FetchProjectIsPrivate returns whether a GitHub Project is private.
(ctx context.Context, client *github.Client, owner, ownerType string, projectNumber int)
| 955 | |
| 956 | // FetchProjectIsPrivate returns whether a GitHub Project is private. |
| 957 | func FetchProjectIsPrivate(ctx context.Context, client *github.Client, owner, ownerType string, projectNumber int) (bool, error) { |
| 958 | project, resp, err := fetchProjectV2(ctx, client, owner, ownerType, projectNumber) |
| 959 | if resp != nil && resp.Body != nil { |
| 960 | defer func() { _ = resp.Body.Close() }() |
| 961 | } |
| 962 | if err != nil { |
| 963 | return false, err |
| 964 | } |
| 965 | if resp == nil || resp.StatusCode != http.StatusOK { |
| 966 | return false, fmt.Errorf("failed to fetch project visibility") |
| 967 | } |
| 968 | return !project.GetPublic(), nil |
| 969 | } |
| 970 | |
| 971 | func getProject(ctx context.Context, client *github.Client, owner, ownerType string, projectNumber int) (*mcp.CallToolResult, bool, any, error) { |
| 972 | project, resp, err := fetchProjectV2(ctx, client, owner, ownerType, projectNumber) |
no test coverage detected