Skip to content

Commit e6f325b

Browse files
authored
feat: Add hosted runners URL and network configuration ID to runner group models (#3825)
1 parent 81f066c commit e6f325b

File tree

4 files changed

+106
-5
lines changed

4 files changed

+106
-5
lines changed

github/actions_runner_groups.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ type RunnerGroup struct {
1818
Default *bool `json:"default,omitempty"`
1919
SelectedRepositoriesURL *string `json:"selected_repositories_url,omitempty"`
2020
RunnersURL *string `json:"runners_url,omitempty"`
21+
HostedRunnersURL *string `json:"hosted_runners_url,omitempty"`
22+
NetworkConfigurationID *string `json:"network_configuration_id,omitempty"`
2123
Inherited *bool `json:"inherited,omitempty"`
2224
AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"`
2325
RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"`
@@ -45,6 +47,8 @@ type CreateRunnerGroupRequest struct {
4547
RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"`
4648
// List of workflows the runner group should be allowed to run. This setting will be ignored unless RestrictedToWorkflows is set to true.
4749
SelectedWorkflows []string `json:"selected_workflows,omitempty"`
50+
// The identifier of a hosted compute network configuration.
51+
NetworkConfigurationID *string `json:"network_configuration_id,omitempty"`
4852
}
4953

5054
// UpdateRunnerGroupRequest represents a request to update a Runner group for an organization.
@@ -54,6 +58,7 @@ type UpdateRunnerGroupRequest struct {
5458
AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"`
5559
RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"`
5660
SelectedWorkflows []string `json:"selected_workflows,omitempty"`
61+
NetworkConfigurationID *string `json:"network_configuration_id,omitempty"`
5762
}
5863

5964
// SetRepoAccessRunnerGroupRequest represents a request to replace the list of repositories

github/actions_runner_groups_test.go

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func TestActionsService_GetOrganizationRunnerGroup(t *testing.T) {
107107

108108
mux.HandleFunc("/orgs/o/actions/runner-groups/2", func(w http.ResponseWriter, r *http.Request) {
109109
testMethod(t, r, "GET")
110-
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":[]}`)
110+
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":[]}`)
111111
})
112112

113113
ctx := t.Context()
@@ -123,6 +123,8 @@ func TestActionsService_GetOrganizationRunnerGroup(t *testing.T) {
123123
Default: Ptr(false),
124124
SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"),
125125
RunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"),
126+
HostedRunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/hosted-runners"),
127+
NetworkConfigurationID: Ptr("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"),
126128
Inherited: Ptr(false),
127129
AllowsPublicRepositories: Ptr(true),
128130
RestrictedToWorkflows: Ptr(false),
@@ -179,7 +181,7 @@ func TestActionsService_CreateOrganizationRunnerGroup(t *testing.T) {
179181

180182
mux.HandleFunc("/orgs/o/actions/runner-groups", func(w http.ResponseWriter, r *http.Request) {
181183
testMethod(t, r, "POST")
182-
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":[]}`)
184+
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":[]}`)
183185
})
184186

185187
ctx := t.Context()
@@ -189,6 +191,7 @@ func TestActionsService_CreateOrganizationRunnerGroup(t *testing.T) {
189191
AllowsPublicRepositories: Ptr(true),
190192
RestrictedToWorkflows: Ptr(false),
191193
SelectedWorkflows: []string{},
194+
NetworkConfigurationID: Ptr("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"),
192195
}
193196
group, _, err := client.Actions.CreateOrganizationRunnerGroup(ctx, "o", req)
194197
if err != nil {
@@ -202,6 +205,8 @@ func TestActionsService_CreateOrganizationRunnerGroup(t *testing.T) {
202205
Default: Ptr(false),
203206
SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"),
204207
RunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"),
208+
HostedRunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/hosted-runners"),
209+
NetworkConfigurationID: Ptr("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"),
205210
Inherited: Ptr(false),
206211
AllowsPublicRepositories: Ptr(true),
207212
RestrictedToWorkflows: Ptr(false),
@@ -233,7 +238,7 @@ func TestActionsService_UpdateOrganizationRunnerGroup(t *testing.T) {
233238

234239
mux.HandleFunc("/orgs/o/actions/runner-groups/2", func(w http.ResponseWriter, r *http.Request) {
235240
testMethod(t, r, "PATCH")
236-
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":[]}`)
241+
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":[]}`)
237242
})
238243

239244
ctx := t.Context()
@@ -243,6 +248,7 @@ func TestActionsService_UpdateOrganizationRunnerGroup(t *testing.T) {
243248
AllowsPublicRepositories: Ptr(true),
244249
RestrictedToWorkflows: Ptr(false),
245250
SelectedWorkflows: []string{},
251+
NetworkConfigurationID: Ptr("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"),
246252
}
247253
group, _, err := client.Actions.UpdateOrganizationRunnerGroup(ctx, "o", 2, req)
248254
if err != nil {
@@ -256,6 +262,8 @@ func TestActionsService_UpdateOrganizationRunnerGroup(t *testing.T) {
256262
Default: Ptr(false),
257263
SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"),
258264
RunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"),
265+
HostedRunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/hosted-runners"),
266+
NetworkConfigurationID: Ptr("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"),
259267
Inherited: Ptr(false),
260268
AllowsPublicRepositories: Ptr(true),
261269
RestrictedToWorkflows: Ptr(false),
@@ -541,6 +549,8 @@ func TestRunnerGroup_Marshal(t *testing.T) {
541549
Default: Ptr(true),
542550
SelectedRepositoriesURL: Ptr("s"),
543551
RunnersURL: Ptr("r"),
552+
HostedRunnersURL: Ptr("h"),
553+
NetworkConfigurationID: Ptr("nc"),
544554
Inherited: Ptr(true),
545555
AllowsPublicRepositories: Ptr(true),
546556
RestrictedToWorkflows: Ptr(false),
@@ -554,6 +564,8 @@ func TestRunnerGroup_Marshal(t *testing.T) {
554564
"default": true,
555565
"selected_repositories_url": "s",
556566
"runners_url": "r",
567+
"hosted_runners_url": "h",
568+
"network_configuration_id": "nc",
557569
"inherited": true,
558570
"allows_public_repositories": true,
559571
"restricted_to_workflows": false,
@@ -577,6 +589,8 @@ func TestRunnerGroups_Marshal(t *testing.T) {
577589
Default: Ptr(true),
578590
SelectedRepositoriesURL: Ptr("s"),
579591
RunnersURL: Ptr("r"),
592+
HostedRunnersURL: Ptr("h"),
593+
NetworkConfigurationID: Ptr("nc"),
580594
Inherited: Ptr(true),
581595
AllowsPublicRepositories: Ptr(true),
582596
RestrictedToWorkflows: Ptr(false),
@@ -594,6 +608,8 @@ func TestRunnerGroups_Marshal(t *testing.T) {
594608
"default": true,
595609
"selected_repositories_url": "s",
596610
"runners_url": "r",
611+
"hosted_runners_url": "h",
612+
"network_configuration_id": "nc",
597613
"inherited": true,
598614
"allows_public_repositories": true,
599615
"restricted_to_workflows": false,
@@ -616,6 +632,7 @@ func TestCreateRunnerGroupRequest_Marshal(t *testing.T) {
616632
AllowsPublicRepositories: Ptr(true),
617633
RestrictedToWorkflows: Ptr(true),
618634
SelectedWorkflows: []string{"a", "b"},
635+
NetworkConfigurationID: Ptr("nc"),
619636
}
620637

621638
want := `{
@@ -625,7 +642,8 @@ func TestCreateRunnerGroupRequest_Marshal(t *testing.T) {
625642
"runners": [1],
626643
"allows_public_repositories": true,
627644
"restricted_to_workflows": true,
628-
"selected_workflows": ["a","b"]
645+
"selected_workflows": ["a","b"],
646+
"network_configuration_id": "nc"
629647
}`
630648

631649
testJSONMarshal(t, u, want)
@@ -641,14 +659,16 @@ func TestUpdateRunnerGroupRequest_Marshal(t *testing.T) {
641659
AllowsPublicRepositories: Ptr(true),
642660
RestrictedToWorkflows: Ptr(false),
643661
SelectedWorkflows: []string{},
662+
NetworkConfigurationID: Ptr("nc"),
644663
}
645664

646665
want := `{
647666
"name": "n",
648667
"visibility": "v",
649668
"allows_public_repositories": true,
650669
"restricted_to_workflows": false,
651-
"selected_workflows": []
670+
"selected_workflows": [],
671+
"network_configuration_id": "nc"
652672
}`
653673

654674
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)