From 75d4b284952e554bd6f2db5f856c87c2ace22484 Mon Sep 17 00:00:00 2001 From: Mike Chen Date: Fri, 3 Feb 2023 17:08:37 -0800 Subject: [PATCH] allow github_actions_runner_group to be created with RestrictedToWorkflows and SelectedWorkflows (#1513) Co-authored-by: Keegan Campbell --- github/resource_github_actions_runner_group.go | 4 ++++ website/docs/r/actions_runner_group.html.markdown | 2 ++ 2 files changed, 6 insertions(+) diff --git a/github/resource_github_actions_runner_group.go b/github/resource_github_actions_runner_group.go index fe431e6687..0711b6cb05 100644 --- a/github/resource_github_actions_runner_group.go +++ b/github/resource_github_actions_runner_group.go @@ -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") @@ -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 { diff --git a/website/docs/r/actions_runner_group.html.markdown b/website/docs/r/actions_runner_group.html.markdown index 3a0c2e0374..3ebf398a89 100644 --- a/website/docs/r/actions_runner_group.html.markdown +++ b/website/docs/r/actions_runner_group.html.markdown @@ -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