Skip to content

Commit a5b5b93

Browse files
authored
Allow empty array for org secret selected repos (#843)
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
1 parent 678ded7 commit a5b5b93

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

github/resource_github_actions_organization_secret.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ func resourceGithubActionsOrganizationSecretCreateOrUpdate(d *schema.ResourceDat
8585
visibility := d.Get("visibility").(string)
8686
selectedRepositories, hasSelectedRepositories := d.GetOk("selected_repository_ids")
8787

88-
if visibility == "selected" && !hasSelectedRepositories {
89-
return fmt.Errorf("Cannot use visbility set to selected without selected_repository_ids")
90-
} else if visibility != "selected" && hasSelectedRepositories {
88+
if visibility != "selected" && hasSelectedRepositories {
9189
return fmt.Errorf("Cannot use selected_repository_ids without visibility being set to selected")
9290
}
9391

0 commit comments

Comments
 (0)