Skip to content

Commit 2d1b724

Browse files
bob-binskfcampbell
andauthored
allow github_actions_runner_group to be created with RestrictedToWorkflows and SelectedWorkflows (#1513)
Co-authored-by: Keegan Campbell <[email protected]>
1 parent 1a70927 commit 2d1b724

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

github/resource_github_actions_runner_group.go

+4
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ func resourceGithubActionsRunnerGroupCreate(d *schema.ResourceData, meta interfa
8686
client := meta.(*Owner).v3client
8787
orgName := meta.(*Owner).name
8888
name := d.Get("name").(string)
89+
restrictedToWorkflows := d.Get("restricted_to_workflows").(bool)
8990
visibility := d.Get("visibility").(string)
9091
selectedRepositories, hasSelectedRepositories := d.GetOk("selected_repository_ids")
92+
selectedWorkflows := d.Get("selected_workflows").([]string)
9193

9294
if visibility != "selected" && hasSelectedRepositories {
9395
return fmt.Errorf("cannot use selected_repository_ids without visibility being set to selected")
@@ -110,7 +112,9 @@ func resourceGithubActionsRunnerGroupCreate(d *schema.ResourceData, meta interfa
110112
github.CreateRunnerGroupRequest{
111113
Name: &name,
112114
Visibility: &visibility,
115+
RestrictedToWorkflows: &restrictedToWorkflows,
113116
SelectedRepositoryIDs: selectedRepositoryIDs,
117+
SelectedWorkflows: selectedWorkflows,
114118
},
115119
)
116120
if err != nil {

website/docs/r/actions_runner_group.html.markdown

+2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ resource "github_actions_runner_group" "example" {
2929
The following arguments are supported:
3030

3131
* `name` - (Required) Name of the runner group
32+
* `restricted_to_workflows` - (Optional) If true, the runner group will be restricted to running only the workflows specified in the selected_workflows array. Defaults to false.
3233
* `selected_repository_ids` - (Optional) IDs of the repositories which should be added to the runner group
34+
* `selected_workflows` - (Optional) List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to true.
3335
* `visibility` - (Optional) Visibility of a runner group. Whether the runner group can include `all`, `selected`, or `private` repositories. A value of `private` is not currently supported due to limitations in the GitHub API.
3436

3537
## Attributes Reference

0 commit comments

Comments
 (0)