Skip to content

Commit

Permalink
Allow empty array for org secret selected repos (#843)
Browse files Browse the repository at this point in the history
Github API will accept empty/null value for selected_repository_ids when visibility is set to selected.
An empty/null value will set selected repositories list to empty, which should be considered as a valid use case
  • Loading branch information
xun-guo-anzx authored Jun 30, 2021
1 parent 678ded7 commit a5b5b93
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions github/resource_github_actions_organization_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ func resourceGithubActionsOrganizationSecretCreateOrUpdate(d *schema.ResourceDat
visibility := d.Get("visibility").(string)
selectedRepositories, hasSelectedRepositories := d.GetOk("selected_repository_ids")

if visibility == "selected" && !hasSelectedRepositories {
return fmt.Errorf("Cannot use visbility set to selected without selected_repository_ids")
} else if visibility != "selected" && hasSelectedRepositories {
if visibility != "selected" && hasSelectedRepositories {
return fmt.Errorf("Cannot use selected_repository_ids without visibility being set to selected")
}

Expand Down

0 comments on commit a5b5b93

Please sign in to comment.