Skip to content

Commit 4eb6c2c

Browse files
feat: Add support for getting Copilot cloud agent configuration (#4241)
1 parent 65d79c6 commit 4eb6c2c

5 files changed

Lines changed: 579 additions & 1 deletion

File tree

github/copilot_cloud_agent.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright 2026 The go-github AUTHORS. All rights reserved.
2+
//
3+
// Use of this source code is governed by a BSD-style
4+
// license that can be found in the LICENSE file.
5+
6+
package github
7+
8+
import (
9+
"context"
10+
"fmt"
11+
)
12+
13+
// CopilotCloudAgentConfiguration represents the Copilot cloud agent configuration for a repository.
14+
type CopilotCloudAgentConfiguration struct {
15+
MCPConfiguration any `json:"mcp_configuration"`
16+
EnabledTools *CopilotCloudAgentEnabledTools `json:"enabled_tools"`
17+
RequireActionsWorkflowApproval bool `json:"require_actions_workflow_approval"`
18+
IsFirewallEnabled bool `json:"is_firewall_enabled"`
19+
IsFirewallRecommendedAllowlistEnabled bool `json:"is_firewall_recommended_allowlist_enabled"`
20+
CustomAllowlist []string `json:"custom_allowlist"`
21+
}
22+
23+
// CopilotCloudAgentEnabledTools represents the enabled review tools for Copilot cloud agent.
24+
type CopilotCloudAgentEnabledTools struct {
25+
Codeql bool `json:"codeql"`
26+
CopilotCodeReview bool `json:"copilot_code_review"`
27+
SecretScanning bool `json:"secret_scanning"`
28+
DependencyVulnerabilityChecks bool `json:"dependency_vulnerability_checks"`
29+
}
30+
31+
// GetCloudAgentConfiguration gets the Copilot cloud agent configuration for a repository.
32+
//
33+
// 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
34+
//
35+
//meta:operation GET /repos/{owner}/{repo}/copilot/cloud-agent/configuration
36+
func (s *CopilotService) GetCloudAgentConfiguration(ctx context.Context, owner, repo string) (*CopilotCloudAgentConfiguration, *Response, error) {
37+
u := fmt.Sprintf("repos/%v/%v/copilot/cloud-agent/configuration", owner, repo)
38+
39+
req, err := s.client.NewRequest(ctx, "GET", u, nil)
40+
if err != nil {
41+
return nil, nil, err
42+
}
43+
44+
var config *CopilotCloudAgentConfiguration
45+
resp, err := s.client.Do(req, &config)
46+
if err != nil {
47+
return nil, resp, err
48+
}
49+
50+
return config, resp, nil
51+
}

0 commit comments

Comments
 (0)