Skip to content

Commit 1867106

Browse files
committed
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: integrations/terraform-provider-github#3274
1 parent 657976b commit 1867106

4 files changed

Lines changed: 95 additions & 2 deletions

File tree

github/enterprise_actions_runner_groups.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ type EnterpriseRunnerGroup struct {
2424
Default *bool `json:"default,omitempty"`
2525
SelectedOrganizationsURL *string `json:"selected_organizations_url,omitempty"`
2626
RunnersURL *string `json:"runners_url,omitempty"`
27+
HostedRunnersURL *string `json:"hosted_runners_url,omitempty"`
28+
NetworkConfigurationID *string `json:"network_configuration_id,omitempty"`
2729
Inherited *bool `json:"inherited,omitempty"`
2830
AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"`
2931
RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"`
@@ -51,6 +53,8 @@ type CreateEnterpriseRunnerGroupRequest struct {
5153
RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"`
5254
// List of workflows the runner group should be allowed to run. This setting will be ignored unless RestrictedToWorkflows is set to true.
5355
SelectedWorkflows []string `json:"selected_workflows,omitempty"`
56+
// The identifier of a hosted compute network configuration.
57+
NetworkConfigurationID *string `json:"network_configuration_id,omitempty"`
5458
}
5559

5660
// UpdateEnterpriseRunnerGroupRequest represents a request to update a Runner group for an enterprise.
@@ -60,6 +64,7 @@ type UpdateEnterpriseRunnerGroupRequest struct {
6064
AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"`
6165
RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"`
6266
SelectedWorkflows []string `json:"selected_workflows,omitempty"`
67+
NetworkConfigurationID *string `json:"network_configuration_id,omitempty"`
6368
}
6469

6570
// SetOrgAccessRunnerGroupRequest represents a request to replace the list of organizations

github/enterprise_actions_runner_groups_test.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,8 @@ func TestEnterpriseRunnerGroup_Marshal(t *testing.T) {
541541
Default: Ptr(true),
542542
SelectedOrganizationsURL: Ptr("s"),
543543
RunnersURL: Ptr("r"),
544+
HostedRunnersURL: Ptr("h"),
545+
NetworkConfigurationID: Ptr("nc"),
544546
Inherited: Ptr(true),
545547
AllowsPublicRepositories: Ptr(true),
546548
RestrictedToWorkflows: Ptr(false),
@@ -553,6 +555,8 @@ func TestEnterpriseRunnerGroup_Marshal(t *testing.T) {
553555
"default": true,
554556
"selected_organizations_url": "s",
555557
"runners_url": "r",
558+
"hosted_runners_url": "h",
559+
"network_configuration_id": "nc",
556560
"inherited": true,
557561
"allows_public_repositories": true,
558562
"restricted_to_workflows": false
@@ -575,6 +579,8 @@ func TestEnterpriseRunnerGroups_Marshal(t *testing.T) {
575579
Default: Ptr(true),
576580
SelectedOrganizationsURL: Ptr("s"),
577581
RunnersURL: Ptr("r"),
582+
HostedRunnersURL: Ptr("h"),
583+
NetworkConfigurationID: Ptr("nc"),
578584
Inherited: Ptr(true),
579585
AllowsPublicRepositories: Ptr(true),
580586
RestrictedToWorkflows: Ptr(false),
@@ -591,6 +597,8 @@ func TestEnterpriseRunnerGroups_Marshal(t *testing.T) {
591597
"default": true,
592598
"selected_organizations_url": "s",
593599
"runners_url": "r",
600+
"hosted_runners_url": "h",
601+
"network_configuration_id": "nc",
594602
"inherited": true,
595603
"allows_public_repositories": true,
596604
"restricted_to_workflows": false
@@ -612,6 +620,7 @@ func TestCreateEnterpriseRunnerGroupRequest_Marshal(t *testing.T) {
612620
AllowsPublicRepositories: Ptr(true),
613621
RestrictedToWorkflows: Ptr(true),
614622
SelectedWorkflows: []string{"a", "b"},
623+
NetworkConfigurationID: Ptr("nc-123"),
615624
}
616625

617626
want := `{
@@ -621,7 +630,8 @@ func TestCreateEnterpriseRunnerGroupRequest_Marshal(t *testing.T) {
621630
"runners": [1],
622631
"allows_public_repositories": true,
623632
"restricted_to_workflows": true,
624-
"selected_workflows": ["a","b"]
633+
"selected_workflows": ["a","b"],
634+
"network_configuration_id": "nc-123"
625635
}`
626636

627637
testJSONMarshal(t, u, want)
@@ -636,13 +646,15 @@ func TestUpdateEnterpriseRunnerGroupRequest_Marshal(t *testing.T) {
636646
Visibility: Ptr("v"),
637647
AllowsPublicRepositories: Ptr(true),
638648
RestrictedToWorkflows: Ptr(false),
649+
NetworkConfigurationID: Ptr("nc-456"),
639650
}
640651

641652
want := `{
642653
"name": "n",
643654
"visibility": "v",
644655
"allows_public_repositories": true,
645-
"restricted_to_workflows": false
656+
"restricted_to_workflows": false,
657+
"network_configuration_id": "nc-456"
646658
}`
647659

648660
testJSONMarshal(t, u, want)

github/github-accessors.go

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)