forked from google/go-github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopilot_cloud_agent.go
More file actions
51 lines (43 loc) · 2.15 KB
/
Copy pathcopilot_cloud_agent.go
File metadata and controls
51 lines (43 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2026 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package github
import (
"context"
"fmt"
)
// CopilotCloudAgentConfiguration represents the Copilot cloud agent configuration for a repository.
type CopilotCloudAgentConfiguration struct {
MCPConfiguration any `json:"mcp_configuration"`
EnabledTools *CopilotCloudAgentEnabledTools `json:"enabled_tools"`
RequireActionsWorkflowApproval bool `json:"require_actions_workflow_approval"`
IsFirewallEnabled bool `json:"is_firewall_enabled"`
IsFirewallRecommendedAllowlistEnabled bool `json:"is_firewall_recommended_allowlist_enabled"`
CustomAllowlist []string `json:"custom_allowlist"`
}
// CopilotCloudAgentEnabledTools represents the enabled review tools for Copilot cloud agent.
type CopilotCloudAgentEnabledTools struct {
Codeql bool `json:"codeql"`
CopilotCodeReview bool `json:"copilot_code_review"`
SecretScanning bool `json:"secret_scanning"`
DependencyVulnerabilityChecks bool `json:"dependency_vulnerability_checks"`
}
// GetCloudAgentConfiguration gets the Copilot cloud agent configuration for a repository.
//
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-cloud-agent-management?apiVersion=2022-11-28#get-copilot-cloud-agent-configuration-for-a-repository
//
//meta:operation GET /repos/{owner}/{repo}/copilot/cloud-agent/configuration
func (s *CopilotService) GetCloudAgentConfiguration(ctx context.Context, owner, repo string) (*CopilotCloudAgentConfiguration, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/copilot/cloud-agent/configuration", owner, repo)
req, err := s.client.NewRequest(ctx, "GET", u, nil)
if err != nil {
return nil, nil, err
}
var config *CopilotCloudAgentConfiguration
resp, err := s.client.Do(req, &config)
if err != nil {
return nil, resp, err
}
return config, resp, nil
}