-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: Add support for getting Copilot cloud agent configuration #4241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
4420993
9168397
37494ff
0451661
ee505fb
0d6344c
17ca49a
8310c32
ccf2948
3b9e0d7
6aa11a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,52 @@ | ||||||
| // 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" | ||||||
| "encoding/json" | ||||||
| "fmt" | ||||||
| ) | ||||||
|
|
||||||
| // CopilotCloudAgentConfiguration represents the Copilot cloud agent configuration for a repository. | ||||||
| type CopilotCloudAgentConfiguration struct { | ||||||
| McpConfiguration *json.RawMessage `json:"mcp_configuration"` | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I apologize for not catching this sooner, but it looks like we need a new initialism ("MCP") to be added to line 424 of tools/structfield/structfield.go (in sorted order) and then update this line as well. Note that So this line needs to be:
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gmlewis thank you for your review !
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, since this is a required field, it looks like the custom Unmarshaler is going to be needed. Agreed, @alexandear? |
||||||
| 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 | ||||||
|
maishivamhoo123 marked this conversation as resolved.
|
||||||
| // | ||||||
| //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) | ||||||
|
maishivamhoo123 marked this conversation as resolved.
|
||||||
| if err != nil { | ||||||
| return nil, resp, err | ||||||
| } | ||||||
|
|
||||||
| return config, resp, nil | ||||||
| } | ||||||
Uh oh!
There was an error while loading. Please reload this page.