Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions github/actions_runner_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down
30 changes: 25 additions & 5 deletions github/actions_runner_groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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),
Expand Down Expand Up @@ -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()
Expand All @@ -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 {
Expand All @@ -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),
Expand Down Expand Up @@ -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()
Expand All @@ -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 {
Expand All @@ -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),
Expand Down Expand Up @@ -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),
Expand All @@ -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,
Expand All @@ -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),
Expand All @@ -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,
Expand All @@ -616,6 +632,7 @@ func TestCreateRunnerGroupRequest_Marshal(t *testing.T) {
AllowsPublicRepositories: Ptr(true),
RestrictedToWorkflows: Ptr(true),
SelectedWorkflows: []string{"a", "b"},
NetworkConfigurationID: Ptr("nc"),
}

want := `{
Expand All @@ -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)
Expand All @@ -641,14 +659,16 @@ func TestUpdateRunnerGroupRequest_Marshal(t *testing.T) {
AllowsPublicRepositories: Ptr(true),
RestrictedToWorkflows: Ptr(false),
SelectedWorkflows: []string{},
NetworkConfigurationID: Ptr("nc"),
}

want := `{
"name": "n",
"visibility": "v",
"allows_public_repositories": true,
"restricted_to_workflows": false,
"selected_workflows": []
"selected_workflows": [],
"network_configuration_id": "nc"
}`

testJSONMarshal(t, u, want)
Expand Down
32 changes: 32 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading