From 1867106ff09f4c9e76b27b36fb93410a9f76fe81 Mon Sep 17 00:00:00 2001 From: Austen Stone Date: Mon, 16 Mar 2026 17:39:58 -0400 Subject: [PATCH] feat: add NetworkConfigurationID and HostedRunnersURL to enterprise runner group types Add NetworkConfigurationID and HostedRunnersURL fields to EnterpriseRunnerGroup, and NetworkConfigurationID to CreateEnterpriseRunnerGroupRequest and UpdateEnterpriseRunnerGroupRequest to match the GitHub API response schema. These fields already exist on the organization-scoped RunnerGroup type but were missing from the enterprise equivalents. The GitHub API returns both fields on enterprise runner group endpoints (List, Get, Create, Update). Fixes: https://github.com/integrations/terraform-provider-github/pull/3274 --- github/enterprise_actions_runner_groups.go | 5 +++ .../enterprise_actions_runner_groups_test.go | 16 ++++++- github/github-accessors.go | 32 ++++++++++++++ github/github-accessors_test.go | 44 +++++++++++++++++++ 4 files changed, 95 insertions(+), 2 deletions(-) diff --git a/github/enterprise_actions_runner_groups.go b/github/enterprise_actions_runner_groups.go index f171df75734..9b7b7589443 100644 --- a/github/enterprise_actions_runner_groups.go +++ b/github/enterprise_actions_runner_groups.go @@ -24,6 +24,8 @@ type EnterpriseRunnerGroup struct { Default *bool `json:"default,omitempty"` SelectedOrganizationsURL *string `json:"selected_organizations_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"` @@ -51,6 +53,8 @@ type CreateEnterpriseRunnerGroupRequest 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"` } // UpdateEnterpriseRunnerGroupRequest represents a request to update a Runner group for an enterprise. @@ -60,6 +64,7 @@ type UpdateEnterpriseRunnerGroupRequest 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"` } // SetOrgAccessRunnerGroupRequest represents a request to replace the list of organizations diff --git a/github/enterprise_actions_runner_groups_test.go b/github/enterprise_actions_runner_groups_test.go index b723ed26257..86c700b3052 100644 --- a/github/enterprise_actions_runner_groups_test.go +++ b/github/enterprise_actions_runner_groups_test.go @@ -541,6 +541,8 @@ func TestEnterpriseRunnerGroup_Marshal(t *testing.T) { Default: Ptr(true), SelectedOrganizationsURL: Ptr("s"), RunnersURL: Ptr("r"), + HostedRunnersURL: Ptr("h"), + NetworkConfigurationID: Ptr("nc"), Inherited: Ptr(true), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), @@ -553,6 +555,8 @@ func TestEnterpriseRunnerGroup_Marshal(t *testing.T) { "default": true, "selected_organizations_url": "s", "runners_url": "r", + "hosted_runners_url": "h", + "network_configuration_id": "nc", "inherited": true, "allows_public_repositories": true, "restricted_to_workflows": false @@ -575,6 +579,8 @@ func TestEnterpriseRunnerGroups_Marshal(t *testing.T) { Default: Ptr(true), SelectedOrganizationsURL: Ptr("s"), RunnersURL: Ptr("r"), + HostedRunnersURL: Ptr("h"), + NetworkConfigurationID: Ptr("nc"), Inherited: Ptr(true), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), @@ -591,6 +597,8 @@ func TestEnterpriseRunnerGroups_Marshal(t *testing.T) { "default": true, "selected_organizations_url": "s", "runners_url": "r", + "hosted_runners_url": "h", + "network_configuration_id": "nc", "inherited": true, "allows_public_repositories": true, "restricted_to_workflows": false @@ -612,6 +620,7 @@ func TestCreateEnterpriseRunnerGroupRequest_Marshal(t *testing.T) { AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(true), SelectedWorkflows: []string{"a", "b"}, + NetworkConfigurationID: Ptr("nc-123"), } want := `{ @@ -621,7 +630,8 @@ func TestCreateEnterpriseRunnerGroupRequest_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-123" }` testJSONMarshal(t, u, want) @@ -636,13 +646,15 @@ func TestUpdateEnterpriseRunnerGroupRequest_Marshal(t *testing.T) { Visibility: Ptr("v"), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), + NetworkConfigurationID: Ptr("nc-456"), } want := `{ "name": "n", "visibility": "v", "allows_public_repositories": true, - "restricted_to_workflows": false + "restricted_to_workflows": false, + "network_configuration_id": "nc-456" }` testJSONMarshal(t, u, want) diff --git a/github/github-accessors.go b/github/github-accessors.go index b529e5e4675..b0754695ddc 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -6886,6 +6886,14 @@ func (c *CreateEnterpriseRunnerGroupRequest) GetName() string { return *c.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) 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 *CreateEnterpriseRunnerGroupRequest) GetRestrictedToWorkflows() bool { if c == nil || c.RestrictedToWorkflows == nil { @@ -10038,6 +10046,14 @@ func (e *EnterpriseRunnerGroup) GetDefault() bool { return *e.Default } +// GetHostedRunnersURL returns the HostedRunnersURL field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetHostedRunnersURL() string { + if e == nil || e.HostedRunnersURL == nil { + return "" + } + return *e.HostedRunnersURL +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (e *EnterpriseRunnerGroup) GetID() int64 { if e == nil || e.ID == nil { @@ -10062,6 +10078,14 @@ func (e *EnterpriseRunnerGroup) GetName() string { return *e.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetNetworkConfigurationID() string { + if e == nil || e.NetworkConfigurationID == nil { + return "" + } + return *e.NetworkConfigurationID +} + // GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. func (e *EnterpriseRunnerGroup) GetRestrictedToWorkflows() bool { if e == nil || e.RestrictedToWorkflows == nil { @@ -30718,6 +30742,14 @@ func (u *UpdateEnterpriseRunnerGroupRequest) GetName() string { return *u.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (u *UpdateEnterpriseRunnerGroupRequest) 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 *UpdateEnterpriseRunnerGroupRequest) GetRestrictedToWorkflows() bool { if u == nil || u.RestrictedToWorkflows == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 84aa1a4190e..06848e44924 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -9014,6 +9014,17 @@ func TestCreateEnterpriseRunnerGroupRequest_GetName(tt *testing.T) { c.GetName() } +func TestCreateEnterpriseRunnerGroupRequest_GetNetworkConfigurationID(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateEnterpriseRunnerGroupRequest{NetworkConfigurationID: &zeroValue} + c.GetNetworkConfigurationID() + c = &CreateEnterpriseRunnerGroupRequest{} + c.GetNetworkConfigurationID() + c = nil + c.GetNetworkConfigurationID() +} + func TestCreateEnterpriseRunnerGroupRequest_GetRestrictedToWorkflows(tt *testing.T) { tt.Parallel() var zeroValue bool @@ -13033,6 +13044,17 @@ func TestEnterpriseRunnerGroup_GetDefault(tt *testing.T) { e.GetDefault() } +func TestEnterpriseRunnerGroup_GetHostedRunnersURL(tt *testing.T) { + tt.Parallel() + var zeroValue string + e := &EnterpriseRunnerGroup{HostedRunnersURL: &zeroValue} + e.GetHostedRunnersURL() + e = &EnterpriseRunnerGroup{} + e.GetHostedRunnersURL() + e = nil + e.GetHostedRunnersURL() +} + func TestEnterpriseRunnerGroup_GetID(tt *testing.T) { tt.Parallel() var zeroValue int64 @@ -13066,6 +13088,17 @@ func TestEnterpriseRunnerGroup_GetName(tt *testing.T) { e.GetName() } +func TestEnterpriseRunnerGroup_GetNetworkConfigurationID(tt *testing.T) { + tt.Parallel() + var zeroValue string + e := &EnterpriseRunnerGroup{NetworkConfigurationID: &zeroValue} + e.GetNetworkConfigurationID() + e = &EnterpriseRunnerGroup{} + e.GetNetworkConfigurationID() + e = nil + e.GetNetworkConfigurationID() +} + func TestEnterpriseRunnerGroup_GetRestrictedToWorkflows(tt *testing.T) { tt.Parallel() var zeroValue bool @@ -39614,6 +39647,17 @@ func TestUpdateEnterpriseRunnerGroupRequest_GetName(tt *testing.T) { u.GetName() } +func TestUpdateEnterpriseRunnerGroupRequest_GetNetworkConfigurationID(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateEnterpriseRunnerGroupRequest{NetworkConfigurationID: &zeroValue} + u.GetNetworkConfigurationID() + u = &UpdateEnterpriseRunnerGroupRequest{} + u.GetNetworkConfigurationID() + u = nil + u.GetNetworkConfigurationID() +} + func TestUpdateEnterpriseRunnerGroupRequest_GetRestrictedToWorkflows(tt *testing.T) { tt.Parallel() var zeroValue bool