Skip to content

Commit

Permalink
allow github_actions_runner_group to be created with RestrictedToWork…
Browse files Browse the repository at this point in the history
…flows and SelectedWorkflows (integrations#1513)

Co-authored-by: Keegan Campbell <me@kfcampbell.com>
  • Loading branch information
bob-bins and kfcampbell authored Feb 4, 2023
1 parent 27ac047 commit 75d4b28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions github/resource_github_actions_runner_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ func resourceGithubActionsRunnerGroupCreate(d *schema.ResourceData, meta interfa
client := meta.(*Owner).v3client
orgName := meta.(*Owner).name
name := d.Get("name").(string)
restrictedToWorkflows := d.Get("restricted_to_workflows").(bool)
visibility := d.Get("visibility").(string)
selectedRepositories, hasSelectedRepositories := d.GetOk("selected_repository_ids")
selectedWorkflows := d.Get("selected_workflows").([]string)

if visibility != "selected" && hasSelectedRepositories {
return fmt.Errorf("cannot use selected_repository_ids without visibility being set to selected")
Expand All @@ -110,7 +112,9 @@ func resourceGithubActionsRunnerGroupCreate(d *schema.ResourceData, meta interfa
github.CreateRunnerGroupRequest{
Name: &name,
Visibility: &visibility,
RestrictedToWorkflows: &restrictedToWorkflows,
SelectedRepositoryIDs: selectedRepositoryIDs,
SelectedWorkflows: selectedWorkflows,
},
)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/actions_runner_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ resource "github_actions_runner_group" "example" {
The following arguments are supported:

* `name` - (Required) Name of the runner group
* `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.
* `selected_repository_ids` - (Optional) IDs of the repositories which should be added to the runner group
* `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.
* `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.

## Attributes Reference
Expand Down

0 comments on commit 75d4b28

Please sign in to comment.