diff --git a/github/actions_runner_groups.go b/github/actions_runner_groups.go index b2ee32f6145..dc54a84853d 100644 --- a/github/actions_runner_groups.go +++ b/github/actions_runner_groups.go @@ -18,6 +18,8 @@ type RunnerGroup struct { Default *bool `json:"default,omitempty"` SelectedRepositoriesURL *string `json:"selected_repositories_url,omitempty"` RunnersURL *string `json:"runners_url,omitempty"` + HostedRunnersURL *string `json:"hosted_runners_url,omitempty"` + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` Inherited *bool `json:"inherited,omitempty"` AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"` RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` @@ -45,6 +47,8 @@ type CreateRunnerGroupRequest struct { RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` // List of workflows the runner group should be allowed to run. This setting will be ignored unless RestrictedToWorkflows is set to true. SelectedWorkflows []string `json:"selected_workflows,omitempty"` + // The identifier of a hosted compute network configuration. + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` } // UpdateRunnerGroupRequest represents a request to update a Runner group for an organization. @@ -54,6 +58,7 @@ type UpdateRunnerGroupRequest struct { AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"` RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` SelectedWorkflows []string `json:"selected_workflows,omitempty"` + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` } // SetRepoAccessRunnerGroupRequest represents a request to replace the list of repositories diff --git a/github/actions_runner_groups_test.go b/github/actions_runner_groups_test.go index 42eff9a933a..c5c83001457 100644 --- a/github/actions_runner_groups_test.go +++ b/github/actions_runner_groups_test.go @@ -107,7 +107,7 @@ func TestActionsService_GetOrganizationRunnerGroup(t *testing.T) { mux.HandleFunc("/orgs/o/actions/runner-groups/2", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - fmt.Fprint(w, `{"id":2,"name":"octo-runner-group","visibility":"selected","default":false,"selected_repositories_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories","runners_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners","inherited":false,"allows_public_repositories":true,"restricted_to_workflows":false,"selected_workflows":[]}`) + fmt.Fprint(w, `{"id":2,"name":"octo-runner-group","visibility":"selected","default":false,"selected_repositories_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories","runners_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners","hosted_runners_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/hosted-runners","network_configuration_id":"EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA","inherited":false,"allows_public_repositories":true,"restricted_to_workflows":false,"selected_workflows":[]}`) }) ctx := t.Context() @@ -123,6 +123,8 @@ func TestActionsService_GetOrganizationRunnerGroup(t *testing.T) { Default: Ptr(false), SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), RunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), + HostedRunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/hosted-runners"), + NetworkConfigurationID: Ptr("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"), Inherited: Ptr(false), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), @@ -179,7 +181,7 @@ func TestActionsService_CreateOrganizationRunnerGroup(t *testing.T) { mux.HandleFunc("/orgs/o/actions/runner-groups", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - fmt.Fprint(w, `{"id":2,"name":"octo-runner-group","visibility":"selected","default":false,"selected_repositories_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories","runners_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners","inherited":false,"allows_public_repositories":true,"restricted_to_workflows":false,"selected_workflows":[]}`) + fmt.Fprint(w, `{"id":2,"name":"octo-runner-group","visibility":"selected","default":false,"selected_repositories_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories","runners_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners","hosted_runners_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/hosted-runners","network_configuration_id":"EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA","inherited":false,"allows_public_repositories":true,"restricted_to_workflows":false,"selected_workflows":[]}`) }) ctx := t.Context() @@ -189,6 +191,7 @@ func TestActionsService_CreateOrganizationRunnerGroup(t *testing.T) { AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, + NetworkConfigurationID: Ptr("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"), } group, _, err := client.Actions.CreateOrganizationRunnerGroup(ctx, "o", req) if err != nil { @@ -202,6 +205,8 @@ func TestActionsService_CreateOrganizationRunnerGroup(t *testing.T) { Default: Ptr(false), SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), RunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), + HostedRunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/hosted-runners"), + NetworkConfigurationID: Ptr("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"), Inherited: Ptr(false), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), @@ -233,7 +238,7 @@ func TestActionsService_UpdateOrganizationRunnerGroup(t *testing.T) { mux.HandleFunc("/orgs/o/actions/runner-groups/2", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") - fmt.Fprint(w, `{"id":2,"name":"octo-runner-group","visibility":"selected","default":false,"selected_repositories_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories","runners_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners","inherited":false,"allows_public_repositories":true,"restricted_to_workflows":false,"selected_workflows":[]}`) + fmt.Fprint(w, `{"id":2,"name":"octo-runner-group","visibility":"selected","default":false,"selected_repositories_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories","runners_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners","hosted_runners_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/hosted-runners","network_configuration_id":"EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA","inherited":false,"allows_public_repositories":true,"restricted_to_workflows":false,"selected_workflows":[]}`) }) ctx := t.Context() @@ -243,6 +248,7 @@ func TestActionsService_UpdateOrganizationRunnerGroup(t *testing.T) { AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, + NetworkConfigurationID: Ptr("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"), } group, _, err := client.Actions.UpdateOrganizationRunnerGroup(ctx, "o", 2, req) if err != nil { @@ -256,6 +262,8 @@ func TestActionsService_UpdateOrganizationRunnerGroup(t *testing.T) { Default: Ptr(false), SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), RunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), + HostedRunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/hosted-runners"), + NetworkConfigurationID: Ptr("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"), Inherited: Ptr(false), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), @@ -541,6 +549,8 @@ func TestRunnerGroup_Marshal(t *testing.T) { Default: Ptr(true), SelectedRepositoriesURL: Ptr("s"), RunnersURL: Ptr("r"), + HostedRunnersURL: Ptr("h"), + NetworkConfigurationID: Ptr("nc"), Inherited: Ptr(true), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), @@ -554,6 +564,8 @@ func TestRunnerGroup_Marshal(t *testing.T) { "default": true, "selected_repositories_url": "s", "runners_url": "r", + "hosted_runners_url": "h", + "network_configuration_id": "nc", "inherited": true, "allows_public_repositories": true, "restricted_to_workflows": false, @@ -577,6 +589,8 @@ func TestRunnerGroups_Marshal(t *testing.T) { Default: Ptr(true), SelectedRepositoriesURL: Ptr("s"), RunnersURL: Ptr("r"), + HostedRunnersURL: Ptr("h"), + NetworkConfigurationID: Ptr("nc"), Inherited: Ptr(true), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), @@ -594,6 +608,8 @@ func TestRunnerGroups_Marshal(t *testing.T) { "default": true, "selected_repositories_url": "s", "runners_url": "r", + "hosted_runners_url": "h", + "network_configuration_id": "nc", "inherited": true, "allows_public_repositories": true, "restricted_to_workflows": false, @@ -616,6 +632,7 @@ func TestCreateRunnerGroupRequest_Marshal(t *testing.T) { AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(true), SelectedWorkflows: []string{"a", "b"}, + NetworkConfigurationID: Ptr("nc"), } want := `{ @@ -625,7 +642,8 @@ func TestCreateRunnerGroupRequest_Marshal(t *testing.T) { "runners": [1], "allows_public_repositories": true, "restricted_to_workflows": true, - "selected_workflows": ["a","b"] + "selected_workflows": ["a","b"], + "network_configuration_id": "nc" }` testJSONMarshal(t, u, want) @@ -641,6 +659,7 @@ func TestUpdateRunnerGroupRequest_Marshal(t *testing.T) { AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, + NetworkConfigurationID: Ptr("nc"), } want := `{ @@ -648,7 +667,8 @@ func TestUpdateRunnerGroupRequest_Marshal(t *testing.T) { "visibility": "v", "allows_public_repositories": true, "restricted_to_workflows": false, - "selected_workflows": [] + "selected_workflows": [], + "network_configuration_id": "nc" }` testJSONMarshal(t, u, want) diff --git a/github/github-accessors.go b/github/github-accessors.go index bba6f7a169a..980bfc5b879 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -6478,6 +6478,14 @@ func (c *CreateRunnerGroupRequest) GetName() string { return *c.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (c *CreateRunnerGroupRequest) GetNetworkConfigurationID() string { + if c == nil || c.NetworkConfigurationID == nil { + return "" + } + return *c.NetworkConfigurationID +} + // GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. func (c *CreateRunnerGroupRequest) GetRestrictedToWorkflows() bool { if c == nil || c.RestrictedToWorkflows == nil { @@ -25678,6 +25686,14 @@ func (r *RunnerGroup) GetDefault() bool { return *r.Default } +// GetHostedRunnersURL returns the HostedRunnersURL field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetHostedRunnersURL() string { + if r == nil || r.HostedRunnersURL == nil { + return "" + } + return *r.HostedRunnersURL +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (r *RunnerGroup) GetID() int64 { if r == nil || r.ID == nil { @@ -25702,6 +25718,14 @@ func (r *RunnerGroup) GetName() string { return *r.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetNetworkConfigurationID() string { + if r == nil || r.NetworkConfigurationID == nil { + return "" + } + return *r.NetworkConfigurationID +} + // GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. func (r *RunnerGroup) GetRestrictedToWorkflows() bool { if r == nil || r.RestrictedToWorkflows == nil { @@ -29334,6 +29358,14 @@ func (u *UpdateRunnerGroupRequest) GetName() string { return *u.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (u *UpdateRunnerGroupRequest) GetNetworkConfigurationID() string { + if u == nil || u.NetworkConfigurationID == nil { + return "" + } + return *u.NetworkConfigurationID +} + // GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. func (u *UpdateRunnerGroupRequest) GetRestrictedToWorkflows() bool { if u == nil || u.RestrictedToWorkflows == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 69d58790f66..a6b4940616b 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -8465,6 +8465,17 @@ func TestCreateRunnerGroupRequest_GetName(tt *testing.T) { c.GetName() } +func TestCreateRunnerGroupRequest_GetNetworkConfigurationID(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateRunnerGroupRequest{NetworkConfigurationID: &zeroValue} + c.GetNetworkConfigurationID() + c = &CreateRunnerGroupRequest{} + c.GetNetworkConfigurationID() + c = nil + c.GetNetworkConfigurationID() +} + func TestCreateRunnerGroupRequest_GetRestrictedToWorkflows(tt *testing.T) { tt.Parallel() var zeroValue bool @@ -33104,6 +33115,17 @@ func TestRunnerGroup_GetDefault(tt *testing.T) { r.GetDefault() } +func TestRunnerGroup_GetHostedRunnersURL(tt *testing.T) { + tt.Parallel() + var zeroValue string + r := &RunnerGroup{HostedRunnersURL: &zeroValue} + r.GetHostedRunnersURL() + r = &RunnerGroup{} + r.GetHostedRunnersURL() + r = nil + r.GetHostedRunnersURL() +} + func TestRunnerGroup_GetID(tt *testing.T) { tt.Parallel() var zeroValue int64 @@ -33137,6 +33159,17 @@ func TestRunnerGroup_GetName(tt *testing.T) { r.GetName() } +func TestRunnerGroup_GetNetworkConfigurationID(tt *testing.T) { + tt.Parallel() + var zeroValue string + r := &RunnerGroup{NetworkConfigurationID: &zeroValue} + r.GetNetworkConfigurationID() + r = &RunnerGroup{} + r.GetNetworkConfigurationID() + r = nil + r.GetNetworkConfigurationID() +} + func TestRunnerGroup_GetRestrictedToWorkflows(tt *testing.T) { tt.Parallel() var zeroValue bool @@ -37798,6 +37831,17 @@ func TestUpdateRunnerGroupRequest_GetName(tt *testing.T) { u.GetName() } +func TestUpdateRunnerGroupRequest_GetNetworkConfigurationID(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateRunnerGroupRequest{NetworkConfigurationID: &zeroValue} + u.GetNetworkConfigurationID() + u = &UpdateRunnerGroupRequest{} + u.GetNetworkConfigurationID() + u = nil + u.GetNetworkConfigurationID() +} + func TestUpdateRunnerGroupRequest_GetRestrictedToWorkflows(tt *testing.T) { tt.Parallel() var zeroValue bool