feat: Add Agents variables API (#4587)

This commit is contained in:
Adam Crews authored and GitHub committed 2026-10-01 14:53:56 -04:00
1 parent e741894b96
commit c674c93c7e
5 files changed
+1333

No files matched your search

+307
View File
@@ -0,0 +1,307 @@
// 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"
)
// ListRepoVariables lists all Agents variables available in a repository.
//
// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#list-repository-variables
//
//meta:operation GET /repos/{owner}/{repo}/agents/variables
func (s *AgentsService) ListRepoVariables(ctx context.Context, owner, repo string, opts *ListOptions) (*ActionsVariables, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/agents/variables", owner, repo)
u, err := addOptions(u, opts)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310))
if err != nil {
return nil, nil, err
}
var variables *ActionsVariables
resp, err := s.client.Do(req, &variables)
if err != nil {
return nil, resp, err
}
return variables, resp, nil
}
// ListRepoOrgVariables lists all organization Agents variables available in a repository.
//
// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#list-repository-organization-variables
//
//meta:operation GET /repos/{owner}/{repo}/agents/organization-variables
func (s *AgentsService) ListRepoOrgVariables(ctx context.Context, owner, repo string, opts *ListOptions) (*ActionsVariables, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/agents/organization-variables", owner, repo)
u, err := addOptions(u, opts)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310))
if err != nil {
return nil, nil, err
}
var variables *ActionsVariables
resp, err := s.client.Do(req, &variables)
if err != nil {
return nil, resp, err
}
return variables, resp, nil
}
// ListOrgVariables lists all Agents variables available in an organization.
//
// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#list-organization-variables
//
//meta:operation GET /orgs/{org}/agents/variables
func (s *AgentsService) ListOrgVariables(ctx context.Context, org string, opts *ListOptions) (*ActionsVariables, *Response, error) {
u := fmt.Sprintf("orgs/%v/agents/variables", org)
u, err := addOptions(u, opts)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310))
if err != nil {
return nil, nil, err
}
var variables *ActionsVariables
resp, err := s.client.Do(req, &variables)
if err != nil {
return nil, resp, err
}
return variables, resp, nil
}
// GetRepoVariable gets a single repository Agents variable.
//
// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#get-a-repository-variable
//
//meta:operation GET /repos/{owner}/{repo}/agents/variables/{name}
func (s *AgentsService) GetRepoVariable(ctx context.Context, owner, repo, name string) (*ActionsVariable, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/agents/variables/%v", owner, repo, name)
req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310))
if err != nil {
return nil, nil, err
}
var variable *ActionsVariable
resp, err := s.client.Do(req, &variable)
if err != nil {
return nil, resp, err
}
return variable, resp, nil
}
// GetOrgVariable gets a single organization Agents variable.
//
// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#get-an-organization-variable
//
//meta:operation GET /orgs/{org}/agents/variables/{name}
func (s *AgentsService) GetOrgVariable(ctx context.Context, org, name string) (*ActionsVariable, *Response, error) {
u := fmt.Sprintf("orgs/%v/agents/variables/%v", org, name)
req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310))
if err != nil {
return nil, nil, err
}
var variable *ActionsVariable
resp, err := s.client.Do(req, &variable)
if err != nil {
return nil, resp, err
}
return variable, resp, nil
}
// CreateRepoVariable creates a repository Agents variable.
//
// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#create-a-repository-variable
//
//meta:operation POST /repos/{owner}/{repo}/agents/variables
func (s *AgentsService) CreateRepoVariable(ctx context.Context, owner, repo string, body ActionsCreateVariableRequest) (*Response, error) {
u := fmt.Sprintf("repos/%v/%v/agents/variables", owner, repo)
req, err := s.client.NewRequest(ctx, "POST", u, body, WithVersion(api20260310))
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}
// CreateOrgVariable creates an organization Agents variable.
//
// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#create-an-organization-variable
//
//meta:operation POST /orgs/{org}/agents/variables
func (s *AgentsService) CreateOrgVariable(ctx context.Context, org string, body ActionsCreateOrgVariableRequest) (*Response, error) {
u := fmt.Sprintf("orgs/%v/agents/variables", org)
req, err := s.client.NewRequest(ctx, "POST", u, body, WithVersion(api20260310))
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}
// UpdateRepoVariable updates a repository Agents variable.
//
// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#update-a-repository-variable
//
//meta:operation PATCH /repos/{owner}/{repo}/agents/variables/{name}
func (s *AgentsService) UpdateRepoVariable(ctx context.Context, owner, repo, name string, body ActionsUpdateVariableRequest) (*Response, error) {
u := fmt.Sprintf("repos/%v/%v/agents/variables/%v", owner, repo, name)
req, err := s.client.NewRequest(ctx, "PATCH", u, body, WithVersion(api20260310))
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}
// UpdateOrgVariable updates an organization Agents variable.
//
// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#update-an-organization-variable
//
//meta:operation PATCH /orgs/{org}/agents/variables/{name}
func (s *AgentsService) UpdateOrgVariable(ctx context.Context, org, name string, body ActionsUpdateOrgVariableRequest) (*Response, error) {
u := fmt.Sprintf("orgs/%v/agents/variables/%v", org, name)
req, err := s.client.NewRequest(ctx, "PATCH", u, body, WithVersion(api20260310))
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}
// DeleteRepoVariable deletes a repository Agents variable using the variable name.
//
// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#delete-a-repository-variable
//
//meta:operation DELETE /repos/{owner}/{repo}/agents/variables/{name}
func (s *AgentsService) DeleteRepoVariable(ctx context.Context, owner, repo, name string) (*Response, error) {
u := fmt.Sprintf("repos/%v/%v/agents/variables/%v", owner, repo, name)
req, err := s.client.NewRequest(ctx, "DELETE", u, nil, WithVersion(api20260310))
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}
// DeleteOrgVariable deletes an organization Agents variable using the variable name.
//
// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#delete-an-organization-variable
//
//meta:operation DELETE /orgs/{org}/agents/variables/{name}
func (s *AgentsService) DeleteOrgVariable(ctx context.Context, org, name string) (*Response, error) {
u := fmt.Sprintf("orgs/%v/agents/variables/%v", org, name)
req, err := s.client.NewRequest(ctx, "DELETE", u, nil, WithVersion(api20260310))
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}
// ListSelectedReposForOrgVariable lists all repositories that have access to an organization Agents variable.
//
// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#list-selected-repositories-for-an-organization-variable
//
//meta:operation GET /orgs/{org}/agents/variables/{name}/repositories
func (s *AgentsService) ListSelectedReposForOrgVariable(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) {
u := fmt.Sprintf("orgs/%v/agents/variables/%v/repositories", org, name)
u, err := addOptions(u, opts)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310))
if err != nil {
return nil, nil, err
}
var result *SelectedReposList
resp, err := s.client.Do(req, &result)
if err != nil {
return nil, resp, err
}
return result, resp, nil
}
// SetSelectedReposForOrgVariable sets the repositories that have access to an organization Agents variable.
//
// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#set-selected-repositories-for-an-organization-variable
//
//meta:operation PUT /orgs/{org}/agents/variables/{name}/repositories
func (s *AgentsService) SetSelectedReposForOrgVariable(ctx context.Context, org, name string, ids []int64) (*Response, error) {
u := fmt.Sprintf("orgs/%v/agents/variables/%v/repositories", org, name)
type repoIDs struct {
SelectedIDs []int64 `json:"selected_repository_ids"`
}
req, err := s.client.NewRequest(ctx, "PUT", u, repoIDs{SelectedIDs: ids}, WithVersion(api20260310))
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}
// AddSelectedRepoToOrgVariable adds a repository to an organization Agents variable.
//
// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#add-selected-repository-to-an-organization-variable
//
//meta:operation PUT /orgs/{org}/agents/variables/{name}/repositories/{repository_id}
func (s *AgentsService) AddSelectedRepoToOrgVariable(ctx context.Context, org, name string, repoID int64) (*Response, error) {
u := fmt.Sprintf("orgs/%v/agents/variables/%v/repositories/%v", org, name, repoID)
req, err := s.client.NewRequest(ctx, "PUT", u, nil, WithVersion(api20260310))
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}
// RemoveSelectedRepoFromOrgVariable removes a repository from an organization Agents variable.
//
// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#remove-selected-repository-from-an-organization-variable
//
//meta:operation DELETE /orgs/{org}/agents/variables/{name}/repositories/{repository_id}
func (s *AgentsService) RemoveSelectedRepoFromOrgVariable(ctx context.Context, org, name string, repoID int64) (*Response, error) {
u := fmt.Sprintf("orgs/%v/agents/variables/%v/repositories/%v", org, name, repoID)
req, err := s.client.NewRequest(ctx, "DELETE", u, nil, WithVersion(api20260310))
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}
+568
View File
@@ -0,0 +1,568 @@
// 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 (
"fmt"
"net/http"
"testing"
"github.com/google/go-cmp/cmp"
)
func TestAgentsService_ListRepoVariables(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
mux.HandleFunc("/repos/o/r/agents/variables", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "X-Github-Api-Version", api20260310)
testFormValues(t, r, values{"per_page": "2", "page": "2"})
fmt.Fprint(w, `{"total_count":4,"variables":[{"name":"A","value":"AA","created_at":`+referenceTimeStr+`,"updated_at":`+referenceTimeStr+`},{"name":"B","value":"BB","created_at":`+referenceTimeStr+`,"updated_at":`+referenceTimeStr+`}]}`)
})
opts := &ListOptions{Page: 2, PerPage: 2}
ctx := t.Context()
variables, _, err := client.Agents.ListRepoVariables(ctx, "o", "r", opts)
if err != nil {
t.Errorf("Agents.ListRepoVariables returned error: %v", err)
}
want := &ActionsVariables{
TotalCount: 4,
Variables: []*ActionsVariable{
{Name: "A", Value: "AA", CreatedAt: &referenceTimestamp, UpdatedAt: &referenceTimestamp},
{Name: "B", Value: "BB", CreatedAt: &referenceTimestamp, UpdatedAt: &referenceTimestamp},
},
}
if !cmp.Equal(variables, want) {
t.Errorf("Agents.ListRepoVariables returned %+v, want %+v", variables, want)
}
const methodName = "ListRepoVariables"
testBadOptions(t, methodName, func() (err error) {
_, _, err = client.Agents.ListRepoVariables(ctx, "\n", "\n", opts)
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
got, resp, err := client.Agents.ListRepoVariables(ctx, "o", "r", opts)
if got != nil {
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
}
return resp, err
})
}
func TestAgentsService_ListRepoOrgVariables(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
mux.HandleFunc("/repos/o/r/agents/organization-variables", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "X-Github-Api-Version", api20260310)
testFormValues(t, r, values{"per_page": "2", "page": "2"})
fmt.Fprint(w, `{"total_count":4,"variables":[{"name":"A","value":"AA","created_at":`+referenceTimeStr+`,"updated_at":`+referenceTimeStr+`},{"name":"B","value":"BB","created_at":`+referenceTimeStr+`,"updated_at":`+referenceTimeStr+`}]}`)
})
opts := &ListOptions{Page: 2, PerPage: 2}
ctx := t.Context()
variables, _, err := client.Agents.ListRepoOrgVariables(ctx, "o", "r", opts)
if err != nil {
t.Errorf("Agents.ListRepoOrgVariables returned error: %v", err)
}
want := &ActionsVariables{
TotalCount: 4,
Variables: []*ActionsVariable{
{Name: "A", Value: "AA", CreatedAt: &referenceTimestamp, UpdatedAt: &referenceTimestamp},
{Name: "B", Value: "BB", CreatedAt: &referenceTimestamp, UpdatedAt: &referenceTimestamp},
},
}
if !cmp.Equal(variables, want) {
t.Errorf("Agents.ListRepoOrgVariables returned %+v, want %+v", variables, want)
}
const methodName = "ListRepoOrgVariables"
testBadOptions(t, methodName, func() (err error) {
_, _, err = client.Agents.ListRepoOrgVariables(ctx, "\n", "\n", opts)
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
got, resp, err := client.Agents.ListRepoOrgVariables(ctx, "o", "r", opts)
if got != nil {
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
}
return resp, err
})
}
func TestAgentsService_GetRepoVariable(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
mux.HandleFunc("/repos/o/r/agents/variables/NAME", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "X-Github-Api-Version", api20260310)
fmt.Fprint(w, `{"name":"NAME","value":"VALUE","created_at":`+referenceTimeStr+`,"updated_at":`+referenceTimeStr+`}`)
})
ctx := t.Context()
variable, _, err := client.Agents.GetRepoVariable(ctx, "o", "r", "NAME")
if err != nil {
t.Errorf("Agents.GetRepoVariable returned error: %v", err)
}
want := &ActionsVariable{
Name: "NAME",
Value: "VALUE",
CreatedAt: &referenceTimestamp,
UpdatedAt: &referenceTimestamp,
}
if !cmp.Equal(variable, want) {
t.Errorf("Agents.GetRepoVariable returned %+v, want %+v", variable, want)
}
const methodName = "GetRepoVariable"
testBadOptions(t, methodName, func() (err error) {
_, _, err = client.Agents.GetRepoVariable(ctx, "\n", "\n", "\n")
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
got, resp, err := client.Agents.GetRepoVariable(ctx, "o", "r", "NAME")
if got != nil {
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
}
return resp, err
})
}
func TestAgentsService_CreateRepoVariable(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
input := ActionsCreateVariableRequest{
Name: "NAME",
Value: "VALUE",
}
mux.HandleFunc("/repos/o/r/agents/variables", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
testHeader(t, r, "X-Github-Api-Version", api20260310)
testHeader(t, r, "Content-Type", "application/json")
testJSONBody(t, r, input)
w.WriteHeader(http.StatusCreated)
})
ctx := t.Context()
_, err := client.Agents.CreateRepoVariable(ctx, "o", "r", input)
if err != nil {
t.Errorf("Agents.CreateRepoVariable returned error: %v", err)
}
const methodName = "CreateRepoVariable"
testBadOptions(t, methodName, func() (err error) {
_, err = client.Agents.CreateRepoVariable(ctx, "\n", "\n", input)
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Agents.CreateRepoVariable(ctx, "o", "r", input)
})
}
func TestAgentsService_UpdateRepoVariable(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
name := "NAME"
input := ActionsUpdateVariableRequest{
Name: &name,
Value: new("VALUE"),
}
mux.HandleFunc("/repos/o/r/agents/variables/NAME", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PATCH")
testHeader(t, r, "X-Github-Api-Version", api20260310)
testHeader(t, r, "Content-Type", "application/json")
testJSONBody(t, r, input)
w.WriteHeader(http.StatusNoContent)
})
ctx := t.Context()
_, err := client.Agents.UpdateRepoVariable(ctx, "o", "r", name, input)
if err != nil {
t.Errorf("Agents.UpdateRepoVariable returned error: %v", err)
}
const methodName = "UpdateRepoVariable"
testBadOptions(t, methodName, func() (err error) {
_, err = client.Agents.UpdateRepoVariable(ctx, "\n", "\n", "\n", input)
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Agents.UpdateRepoVariable(ctx, "o", "r", name, input)
})
}
func TestAgentsService_DeleteRepoVariable(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
mux.HandleFunc("/repos/o/r/agents/variables/NAME", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
testHeader(t, r, "X-Github-Api-Version", api20260310)
w.WriteHeader(http.StatusNoContent)
})
ctx := t.Context()
_, err := client.Agents.DeleteRepoVariable(ctx, "o", "r", "NAME")
if err != nil {
t.Errorf("Agents.DeleteRepoVariable returned error: %v", err)
}
const methodName = "DeleteRepoVariable"
testBadOptions(t, methodName, func() (err error) {
_, err = client.Agents.DeleteRepoVariable(ctx, "\n", "\n", "\n")
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Agents.DeleteRepoVariable(ctx, "o", "r", "NAME")
})
}
func TestAgentsService_ListOrgVariables(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
mux.HandleFunc("/orgs/o/agents/variables", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "X-Github-Api-Version", api20260310)
testFormValues(t, r, values{"per_page": "2", "page": "2"})
fmt.Fprint(w, `{"total_count":3,"variables":[{"name":"A","value":"AA","created_at":`+referenceTimeStr+`,"updated_at":`+referenceTimeStr+`,"visibility":"private"},{"name":"B","value":"BB","created_at":`+referenceTimeStr+`,"updated_at":`+referenceTimeStr+`,"visibility":"all"},{"name":"C","value":"CC","created_at":`+referenceTimeStr+`,"updated_at":`+referenceTimeStr+`,"visibility":"selected","selected_repositories_url":"https://api.github.com/orgs/octo-org/agents/variables/VAR/repositories"}]}`)
})
opts := &ListOptions{Page: 2, PerPage: 2}
ctx := t.Context()
variables, _, err := client.Agents.ListOrgVariables(ctx, "o", opts)
if err != nil {
t.Errorf("Agents.ListOrgVariables returned error: %v", err)
}
want := &ActionsVariables{
TotalCount: 3,
Variables: []*ActionsVariable{
{Name: "A", Value: "AA", CreatedAt: &referenceTimestamp, UpdatedAt: &referenceTimestamp, Visibility: new("private")},
{Name: "B", Value: "BB", CreatedAt: &referenceTimestamp, UpdatedAt: &referenceTimestamp, Visibility: new("all")},
{Name: "C", Value: "CC", CreatedAt: &referenceTimestamp, UpdatedAt: &referenceTimestamp, Visibility: new("selected"), SelectedRepositoriesURL: new("https://api.github.com/orgs/octo-org/agents/variables/VAR/repositories")},
},
}
if !cmp.Equal(variables, want) {
t.Errorf("Agents.ListOrgVariables returned %+v, want %+v", variables, want)
}
const methodName = "ListOrgVariables"
testBadOptions(t, methodName, func() (err error) {
_, _, err = client.Agents.ListOrgVariables(ctx, "\n", opts)
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
got, resp, err := client.Agents.ListOrgVariables(ctx, "o", opts)
if got != nil {
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
}
return resp, err
})
}
func TestAgentsService_GetOrgVariable(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
mux.HandleFunc("/orgs/o/agents/variables/NAME", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "X-Github-Api-Version", api20260310)
fmt.Fprint(w, `{"name":"NAME","value":"VALUE","created_at":`+referenceTimeStr+`,"updated_at":`+referenceTimeStr+`,"visibility":"selected","selected_repositories_url":"https://api.github.com/orgs/octo-org/agents/variables/VAR/repositories"}`)
})
ctx := t.Context()
variable, _, err := client.Agents.GetOrgVariable(ctx, "o", "NAME")
if err != nil {
t.Errorf("Agents.GetOrgVariable returned error: %v", err)
}
want := &ActionsVariable{
Name: "NAME",
Value: "VALUE",
CreatedAt: &referenceTimestamp,
UpdatedAt: &referenceTimestamp,
Visibility: new("selected"),
SelectedRepositoriesURL: new("https://api.github.com/orgs/octo-org/agents/variables/VAR/repositories"),
}
if !cmp.Equal(variable, want) {
t.Errorf("Agents.GetOrgVariable returned %+v, want %+v", variable, want)
}
const methodName = "GetOrgVariable"
testBadOptions(t, methodName, func() (err error) {
_, _, err = client.Agents.GetOrgVariable(ctx, "\n", "\n")
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
got, resp, err := client.Agents.GetOrgVariable(ctx, "o", "NAME")
if got != nil {
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
}
return resp, err
})
}
func TestAgentsService_CreateOrgVariable(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
input := ActionsCreateOrgVariableRequest{
Name: "NAME",
Value: "VALUE",
Visibility: "selected",
SelectedRepositoryIDs: []int64{1296269, 1269280},
}
mux.HandleFunc("/orgs/o/agents/variables", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
testHeader(t, r, "X-Github-Api-Version", api20260310)
testHeader(t, r, "Content-Type", "application/json")
testJSONBody(t, r, input)
w.WriteHeader(http.StatusCreated)
})
ctx := t.Context()
_, err := client.Agents.CreateOrgVariable(ctx, "o", input)
if err != nil {
t.Errorf("Agents.CreateOrgVariable returned error: %v", err)
}
const methodName = "CreateOrgVariable"
testBadOptions(t, methodName, func() (err error) {
_, err = client.Agents.CreateOrgVariable(ctx, "\n", input)
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Agents.CreateOrgVariable(ctx, "o", input)
})
}
func TestAgentsService_UpdateOrgVariable(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
name := "NAME"
input := ActionsUpdateOrgVariableRequest{
Name: &name,
Value: new("VALUE"),
Visibility: new("selected"),
SelectedRepositoryIDs: []int64{1296269, 1269280},
}
mux.HandleFunc("/orgs/o/agents/variables/NAME", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PATCH")
testHeader(t, r, "X-Github-Api-Version", api20260310)
testHeader(t, r, "Content-Type", "application/json")
testJSONBody(t, r, input)
w.WriteHeader(http.StatusNoContent)
})
ctx := t.Context()
_, err := client.Agents.UpdateOrgVariable(ctx, "o", name, input)
if err != nil {
t.Errorf("Agents.UpdateOrgVariable returned error: %v", err)
}
const methodName = "UpdateOrgVariable"
testBadOptions(t, methodName, func() (err error) {
_, err = client.Agents.UpdateOrgVariable(ctx, "\n", "\n", input)
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Agents.UpdateOrgVariable(ctx, "o", name, input)
})
}
func TestAgentsService_ListSelectedReposForOrgVariable(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
mux.HandleFunc("/orgs/o/agents/variables/NAME/repositories", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "X-Github-Api-Version", api20260310)
fmt.Fprint(w, `{"total_count":1,"repositories":[{"id":1}]}`)
})
opts := &ListOptions{Page: 2, PerPage: 2}
ctx := t.Context()
repos, _, err := client.Agents.ListSelectedReposForOrgVariable(ctx, "o", "NAME", opts)
if err != nil {
t.Errorf("Agents.ListSelectedReposForOrgVariable returned error: %v", err)
}
want := &SelectedReposList{
TotalCount: new(1),
Repositories: []*Repository{
{ID: new(int64(1))},
},
}
if !cmp.Equal(repos, want) {
t.Errorf("Agents.ListSelectedReposForOrgVariable returned %+v, want %+v", repos, want)
}
const methodName = "ListSelectedReposForOrgVariable"
testBadOptions(t, methodName, func() (err error) {
_, _, err = client.Agents.ListSelectedReposForOrgVariable(ctx, "\n", "\n", opts)
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
got, resp, err := client.Agents.ListSelectedReposForOrgVariable(ctx, "o", "NAME", opts)
if got != nil {
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
}
return resp, err
})
}
func TestAgentsService_SetSelectedReposForOrgVariable(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
input := []int64{64780797}
mux.HandleFunc("/orgs/o/agents/variables/NAME/repositories", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
testHeader(t, r, "X-Github-Api-Version", api20260310)
testHeader(t, r, "Content-Type", "application/json")
testJSONBody(t, r, struct {
SelectedIDs []int64 `json:"selected_repository_ids"`
}{
SelectedIDs: input,
})
w.WriteHeader(http.StatusNoContent)
})
ctx := t.Context()
_, err := client.Agents.SetSelectedReposForOrgVariable(ctx, "o", "NAME", input)
if err != nil {
t.Errorf("Agents.SetSelectedReposForOrgVariable returned error: %v", err)
}
const methodName = "SetSelectedReposForOrgVariable"
testBadOptions(t, methodName, func() (err error) {
_, err = client.Agents.SetSelectedReposForOrgVariable(ctx, "\n", "\n", input)
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Agents.SetSelectedReposForOrgVariable(ctx, "o", "NAME", input)
})
}
func TestAgentsService_AddSelectedRepoToOrgVariable(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
mux.HandleFunc("/orgs/o/agents/variables/NAME/repositories/1234", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
testHeader(t, r, "X-Github-Api-Version", api20260310)
w.WriteHeader(http.StatusNoContent)
})
repoID := int64(1234)
ctx := t.Context()
_, err := client.Agents.AddSelectedRepoToOrgVariable(ctx, "o", "NAME", repoID)
if err != nil {
t.Errorf("Agents.AddSelectedRepoToOrgVariable returned error: %v", err)
}
const methodName = "AddSelectedRepoToOrgVariable"
testBadOptions(t, methodName, func() (err error) {
_, err = client.Agents.AddSelectedRepoToOrgVariable(ctx, "o", "NAME", 0)
return err
})
testBadOptions(t, methodName, func() (err error) {
_, err = client.Agents.AddSelectedRepoToOrgVariable(ctx, "\n", "\n", repoID)
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Agents.AddSelectedRepoToOrgVariable(ctx, "o", "NAME", repoID)
})
}
func TestAgentsService_RemoveSelectedRepoFromOrgVariable(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
mux.HandleFunc("/orgs/o/agents/variables/NAME/repositories/1234", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
testHeader(t, r, "X-Github-Api-Version", api20260310)
w.WriteHeader(http.StatusNoContent)
})
repoID := int64(1234)
ctx := t.Context()
_, err := client.Agents.RemoveSelectedRepoFromOrgVariable(ctx, "o", "NAME", repoID)
if err != nil {
t.Errorf("Agents.RemoveSelectedRepoFromOrgVariable returned error: %v", err)
}
const methodName = "RemoveSelectedRepoFromOrgVariable"
testBadOptions(t, methodName, func() (err error) {
_, err = client.Agents.RemoveSelectedRepoFromOrgVariable(ctx, "o", "NAME", 0)
return err
})
testBadOptions(t, methodName, func() (err error) {
_, err = client.Agents.RemoveSelectedRepoFromOrgVariable(ctx, "\n", "\n", repoID)
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Agents.RemoveSelectedRepoFromOrgVariable(ctx, "o", "NAME", repoID)
})
}
func TestAgentsService_DeleteOrgVariable(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
mux.HandleFunc("/orgs/o/agents/variables/NAME", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
testHeader(t, r, "X-Github-Api-Version", api20260310)
w.WriteHeader(http.StatusNoContent)
})
ctx := t.Context()
_, err := client.Agents.DeleteOrgVariable(ctx, "o", "NAME")
if err != nil {
t.Errorf("Agents.DeleteOrgVariable returned error: %v", err)
}
const methodName = "DeleteOrgVariable"
testBadOptions(t, methodName, func() (err error) {
_, err = client.Agents.DeleteOrgVariable(ctx, "\n", "\n")
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Agents.DeleteOrgVariable(ctx, "o", "NAME")
})
}
+140
View File
@@ -1603,6 +1603,41 @@ func (s *AgentsService) ListOrgSecretsIter(ctx context.Context, org string, opts
}
}
// ListOrgVariablesIter returns an iterator that paginates through all results of ListOrgVariables.
func (s *AgentsService) ListOrgVariablesIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] {
return func(yield func(*ActionsVariable, error) bool) {
// Create a copy of opts to avoid mutating the caller's struct
if opts == nil {
opts = &ListOptions{}
} else {
opts = new(*opts)
}
for {
results, resp, err := s.ListOrgVariables(ctx, org, opts)
if err != nil {
yield(nil, err)
return
}
var iterItems []*ActionsVariable
if results != nil {
iterItems = results.Variables
}
for _, item := range iterItems {
if !yield(item, nil) {
return
}
}
if resp.NextPage == 0 {
break
}
opts.Page = resp.NextPage
}
}
}
// ListRepoOrgSecretsIter returns an iterator that paginates through all results of ListRepoOrgSecrets.
func (s *AgentsService) ListRepoOrgSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] {
return func(yield func(*Secret, error) bool) {
@@ -1638,6 +1673,41 @@ func (s *AgentsService) ListRepoOrgSecretsIter(ctx context.Context, owner string
}
}
// ListRepoOrgVariablesIter returns an iterator that paginates through all results of ListRepoOrgVariables.
func (s *AgentsService) ListRepoOrgVariablesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] {
return func(yield func(*ActionsVariable, error) bool) {
// Create a copy of opts to avoid mutating the caller's struct
if opts == nil {
opts = &ListOptions{}
} else {
opts = new(*opts)
}
for {
results, resp, err := s.ListRepoOrgVariables(ctx, owner, repo, opts)
if err != nil {
yield(nil, err)
return
}
var iterItems []*ActionsVariable
if results != nil {
iterItems = results.Variables
}
for _, item := range iterItems {
if !yield(item, nil) {
return
}
}
if resp.NextPage == 0 {
break
}
opts.Page = resp.NextPage
}
}
}
// ListRepoSecretsIter returns an iterator that paginates through all results of ListRepoSecrets.
func (s *AgentsService) ListRepoSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] {
return func(yield func(*Secret, error) bool) {
@@ -1673,6 +1743,41 @@ func (s *AgentsService) ListRepoSecretsIter(ctx context.Context, owner string, r
}
}
// ListRepoVariablesIter returns an iterator that paginates through all results of ListRepoVariables.
func (s *AgentsService) ListRepoVariablesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] {
return func(yield func(*ActionsVariable, error) bool) {
// Create a copy of opts to avoid mutating the caller's struct
if opts == nil {
opts = &ListOptions{}
} else {
opts = new(*opts)
}
for {
results, resp, err := s.ListRepoVariables(ctx, owner, repo, opts)
if err != nil {
yield(nil, err)
return
}
var iterItems []*ActionsVariable
if results != nil {
iterItems = results.Variables
}
for _, item := range iterItems {
if !yield(item, nil) {
return
}
}
if resp.NextPage == 0 {
break
}
opts.Page = resp.NextPage
}
}
}
// ListSelectedReposForOrgSecretIter returns an iterator that paginates through all results of ListSelectedReposForOrgSecret.
func (s *AgentsService) ListSelectedReposForOrgSecretIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] {
return func(yield func(*Repository, error) bool) {
@@ -1708,6 +1813,41 @@ func (s *AgentsService) ListSelectedReposForOrgSecretIter(ctx context.Context, o
}
}
// ListSelectedReposForOrgVariableIter returns an iterator that paginates through all results of ListSelectedReposForOrgVariable.
func (s *AgentsService) ListSelectedReposForOrgVariableIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] {
return func(yield func(*Repository, error) bool) {
// Create a copy of opts to avoid mutating the caller's struct
if opts == nil {
opts = &ListOptions{}
} else {
opts = new(*opts)
}
for {
results, resp, err := s.ListSelectedReposForOrgVariable(ctx, org, name, opts)
if err != nil {
yield(nil, err)
return
}
var iterItems []*Repository
if results != nil {
iterItems = results.Repositories
}
for _, item := range iterItems {
if !yield(item, nil) {
return
}
}
if resp.NextPage == 0 {
break
}
opts.Page = resp.NextPage
}
}
}
// ListHookDeliveriesIter returns an iterator that paginates through all results of ListHookDeliveries.
func (s *AppsService) ListHookDeliveriesIter(ctx context.Context, opts *ListCursorOptions) iter.Seq2[*HookDelivery, error] {
return func(yield func(*HookDelivery, error) bool) {
+288
View File
@@ -3399,6 +3399,78 @@ func TestAgentsService_ListOrgSecretsIter(t *testing.T) {
}
}
func TestAgentsService_ListOrgVariablesIter(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
var callNum int
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
callNum++
switch callNum {
case 1:
w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
fmt.Fprint(w, `{"variables": [{},{},{}]}`)
case 2:
fmt.Fprint(w, `{"variables": [{},{},{},{}]}`)
case 3:
fmt.Fprint(w, `{"variables": [{},{}]}`)
case 4:
w.WriteHeader(http.StatusNotFound)
case 5:
fmt.Fprint(w, `{"variables": [{},{}]}`)
}
})
iter := client.Agents.ListOrgVariablesIter(t.Context(), "", nil)
var gotItems int
for _, err := range iter {
gotItems++
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
}
if want := 7; gotItems != want {
t.Errorf("client.Agents.ListOrgVariablesIter call 1 got %v items; want %v", gotItems, want)
}
opts := &ListOptions{}
iter = client.Agents.ListOrgVariablesIter(t.Context(), "", opts)
gotItems = 0
for _, err := range iter {
gotItems++
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
}
if want := 2; gotItems != want {
t.Errorf("client.Agents.ListOrgVariablesIter call 2 got %v items; want %v", gotItems, want)
}
iter = client.Agents.ListOrgVariablesIter(t.Context(), "", nil)
gotItems = 0
for _, err := range iter {
gotItems++
if err == nil {
t.Error("expected error; got nil")
}
}
if gotItems != 1 {
t.Errorf("client.Agents.ListOrgVariablesIter call 3 got %v items; want 1 (an error)", gotItems)
}
iter = client.Agents.ListOrgVariablesIter(t.Context(), "", nil)
gotItems = 0
iter(func(item *ActionsVariable, err error) bool {
gotItems++
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
return false
})
if gotItems != 1 {
t.Errorf("client.Agents.ListOrgVariablesIter call 4 got %v items; want 1 (an error)", gotItems)
}
}
func TestAgentsService_ListRepoOrgSecretsIter(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
@@ -3471,6 +3543,78 @@ func TestAgentsService_ListRepoOrgSecretsIter(t *testing.T) {
}
}
func TestAgentsService_ListRepoOrgVariablesIter(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
var callNum int
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
callNum++
switch callNum {
case 1:
w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
fmt.Fprint(w, `{"variables": [{},{},{}]}`)
case 2:
fmt.Fprint(w, `{"variables": [{},{},{},{}]}`)
case 3:
fmt.Fprint(w, `{"variables": [{},{}]}`)
case 4:
w.WriteHeader(http.StatusNotFound)
case 5:
fmt.Fprint(w, `{"variables": [{},{}]}`)
}
})
iter := client.Agents.ListRepoOrgVariablesIter(t.Context(), "", "", nil)
var gotItems int
for _, err := range iter {
gotItems++
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
}
if want := 7; gotItems != want {
t.Errorf("client.Agents.ListRepoOrgVariablesIter call 1 got %v items; want %v", gotItems, want)
}
opts := &ListOptions{}
iter = client.Agents.ListRepoOrgVariablesIter(t.Context(), "", "", opts)
gotItems = 0
for _, err := range iter {
gotItems++
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
}
if want := 2; gotItems != want {
t.Errorf("client.Agents.ListRepoOrgVariablesIter call 2 got %v items; want %v", gotItems, want)
}
iter = client.Agents.ListRepoOrgVariablesIter(t.Context(), "", "", nil)
gotItems = 0
for _, err := range iter {
gotItems++
if err == nil {
t.Error("expected error; got nil")
}
}
if gotItems != 1 {
t.Errorf("client.Agents.ListRepoOrgVariablesIter call 3 got %v items; want 1 (an error)", gotItems)
}
iter = client.Agents.ListRepoOrgVariablesIter(t.Context(), "", "", nil)
gotItems = 0
iter(func(item *ActionsVariable, err error) bool {
gotItems++
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
return false
})
if gotItems != 1 {
t.Errorf("client.Agents.ListRepoOrgVariablesIter call 4 got %v items; want 1 (an error)", gotItems)
}
}
func TestAgentsService_ListRepoSecretsIter(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
@@ -3543,6 +3687,78 @@ func TestAgentsService_ListRepoSecretsIter(t *testing.T) {
}
}
func TestAgentsService_ListRepoVariablesIter(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
var callNum int
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
callNum++
switch callNum {
case 1:
w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
fmt.Fprint(w, `{"variables": [{},{},{}]}`)
case 2:
fmt.Fprint(w, `{"variables": [{},{},{},{}]}`)
case 3:
fmt.Fprint(w, `{"variables": [{},{}]}`)
case 4:
w.WriteHeader(http.StatusNotFound)
case 5:
fmt.Fprint(w, `{"variables": [{},{}]}`)
}
})
iter := client.Agents.ListRepoVariablesIter(t.Context(), "", "", nil)
var gotItems int
for _, err := range iter {
gotItems++
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
}
if want := 7; gotItems != want {
t.Errorf("client.Agents.ListRepoVariablesIter call 1 got %v items; want %v", gotItems, want)
}
opts := &ListOptions{}
iter = client.Agents.ListRepoVariablesIter(t.Context(), "", "", opts)
gotItems = 0
for _, err := range iter {
gotItems++
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
}
if want := 2; gotItems != want {
t.Errorf("client.Agents.ListRepoVariablesIter call 2 got %v items; want %v", gotItems, want)
}
iter = client.Agents.ListRepoVariablesIter(t.Context(), "", "", nil)
gotItems = 0
for _, err := range iter {
gotItems++
if err == nil {
t.Error("expected error; got nil")
}
}
if gotItems != 1 {
t.Errorf("client.Agents.ListRepoVariablesIter call 3 got %v items; want 1 (an error)", gotItems)
}
iter = client.Agents.ListRepoVariablesIter(t.Context(), "", "", nil)
gotItems = 0
iter(func(item *ActionsVariable, err error) bool {
gotItems++
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
return false
})
if gotItems != 1 {
t.Errorf("client.Agents.ListRepoVariablesIter call 4 got %v items; want 1 (an error)", gotItems)
}
}
func TestAgentsService_ListSelectedReposForOrgSecretIter(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
@@ -3615,6 +3831,78 @@ func TestAgentsService_ListSelectedReposForOrgSecretIter(t *testing.T) {
}
}
func TestAgentsService_ListSelectedReposForOrgVariableIter(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
var callNum int
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
callNum++
switch callNum {
case 1:
w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
fmt.Fprint(w, `{"repositories": [{},{},{}]}`)
case 2:
fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`)
case 3:
fmt.Fprint(w, `{"repositories": [{},{}]}`)
case 4:
w.WriteHeader(http.StatusNotFound)
case 5:
fmt.Fprint(w, `{"repositories": [{},{}]}`)
}
})
iter := client.Agents.ListSelectedReposForOrgVariableIter(t.Context(), "", "", nil)
var gotItems int
for _, err := range iter {
gotItems++
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
}
if want := 7; gotItems != want {
t.Errorf("client.Agents.ListSelectedReposForOrgVariableIter call 1 got %v items; want %v", gotItems, want)
}
opts := &ListOptions{}
iter = client.Agents.ListSelectedReposForOrgVariableIter(t.Context(), "", "", opts)
gotItems = 0
for _, err := range iter {
gotItems++
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
}
if want := 2; gotItems != want {
t.Errorf("client.Agents.ListSelectedReposForOrgVariableIter call 2 got %v items; want %v", gotItems, want)
}
iter = client.Agents.ListSelectedReposForOrgVariableIter(t.Context(), "", "", nil)
gotItems = 0
for _, err := range iter {
gotItems++
if err == nil {
t.Error("expected error; got nil")
}
}
if gotItems != 1 {
t.Errorf("client.Agents.ListSelectedReposForOrgVariableIter call 3 got %v items; want 1 (an error)", gotItems)
}
iter = client.Agents.ListSelectedReposForOrgVariableIter(t.Context(), "", "", nil)
gotItems = 0
iter(func(item *Repository, err error) bool {
gotItems++
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
return false
})
if gotItems != 1 {
t.Errorf("client.Agents.ListSelectedReposForOrgVariableIter call 4 got %v items; want 1 (an error)", gotItems)
}
}
func TestAppsService_ListHookDeliveriesIter(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
+30
View File
@@ -97,6 +97,24 @@ operation_overrides:
documentation_url: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#remove-selected-repository-from-an-organization-secret
- name: PUT /orgs/{org}/agents/secrets/{secret_name}/repositories/{repository_id}
documentation_url: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#add-selected-repository-to-an-organization-secret
- name: GET /orgs/{org}/agents/variables
documentation_url: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#list-organization-variables
- name: POST /orgs/{org}/agents/variables
documentation_url: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#create-an-organization-variable
- name: DELETE /orgs/{org}/agents/variables/{name}
documentation_url: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#delete-an-organization-variable
- name: GET /orgs/{org}/agents/variables/{name}
documentation_url: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#get-an-organization-variable
- name: PATCH /orgs/{org}/agents/variables/{name}
documentation_url: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#update-an-organization-variable
- name: GET /orgs/{org}/agents/variables/{name}/repositories
documentation_url: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#list-selected-repositories-for-an-organization-variable
- name: PUT /orgs/{org}/agents/variables/{name}/repositories
documentation_url: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#set-selected-repositories-for-an-organization-variable
- name: DELETE /orgs/{org}/agents/variables/{name}/repositories/{repository_id}
documentation_url: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#remove-selected-repository-from-an-organization-variable
- name: PUT /orgs/{org}/agents/variables/{name}/repositories/{repository_id}
documentation_url: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#add-selected-repository-to-an-organization-variable
- name: GET /orgs/{org}/private-registries
documentation_url: https://docs.github.com/rest/private-registries/organization-configurations?apiVersion=2026-03-10#list-private-registries-for-an-organization
- name: POST /orgs/{org}/private-registries
@@ -121,6 +139,18 @@ operation_overrides:
documentation_url: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#get-a-repository-secret
- name: PUT /repos/{owner}/{repo}/agents/secrets/{secret_name}
documentation_url: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#create-or-update-a-repository-secret
- name: GET /repos/{owner}/{repo}/agents/organization-variables
documentation_url: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#list-repository-organization-variables
- name: GET /repos/{owner}/{repo}/agents/variables
documentation_url: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#list-repository-variables
- name: POST /repos/{owner}/{repo}/agents/variables
documentation_url: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#create-a-repository-variable
- name: DELETE /repos/{owner}/{repo}/agents/variables/{name}
documentation_url: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#delete-a-repository-variable
- name: GET /repos/{owner}/{repo}/agents/variables/{name}
documentation_url: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#get-a-repository-variable
- name: PATCH /repos/{owner}/{repo}/agents/variables/{name}
documentation_url: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#update-a-repository-variable
- name: DELETE /repos/{owner}/{repo}/pages
documentation_url: https://docs.github.com/rest/pages/pages#delete-a-github-pages-site
- name: GET /repos/{owner}/{repo}/pages