Skip to content

Commit 1293372

Browse files
committed
support ent owner in non-org rulesets as well
1 parent b480640 commit 1293372

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

github/resource_github_repository_ruleset.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ func resourceGithubRepositoryRuleset() *schema.Resource {
6868
Type: schema.TypeInt,
6969
Optional: true,
7070
Default: nil,
71-
Description: "The ID of the actor that can bypass a ruleset. When `actor_type` is `OrganizationAdmin`, this should be set to `1`. Some resources such as DeployKey do not have an ID and this should be omitted.",
71+
Description: "The ID of the actor that can bypass a ruleset. Some actor types such as OrganizationAdmin/EnterpriseOwner/DeployKey do not have an ID and this should be omitted.",
7272
},
7373
"actor_type": {
7474
Type: schema.TypeString,
7575
Required: true,
76-
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"RepositoryRole", "Team", "Integration", "OrganizationAdmin", "DeployKey"}, false)),
76+
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"RepositoryRole", "Team", "Integration", "OrganizationAdmin", "DeployKey", "EnterpriseOwner"}, false)),
7777
Description: "The type of actor that can bypass a ruleset. See https://docs.github.com/en/rest/repos/rules for more information.",
7878
},
7979
"bypass_mode": {

github/resource_github_repository_ruleset_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ resource "github_repository_ruleset" "test" {
173173
}
174174
}
175175
176+
bypass_actors {
177+
actor_type = "EnterpriseOwner"
178+
bypass_mode = "always"
179+
}
180+
176181
rules {
177182
branch_name_pattern {
178183
name = "test"
@@ -193,6 +198,9 @@ resource "github_repository_ruleset" "test" {
193198
Check: resource.ComposeTestCheckFunc(
194199
resource.TestCheckResourceAttr("github_repository_ruleset.test", "name", "test"),
195200
resource.TestCheckResourceAttr("github_repository_ruleset.test", "enforcement", "active"),
201+
resource.TestCheckResourceAttr("github_repository_ruleset.test", "bypass_actors.#", "1"),
202+
resource.TestCheckResourceAttr("github_repository_ruleset.test", "bypass_actors.0.actor_type", "EnterpriseOwner"),
203+
resource.TestCheckResourceAttr("github_repository_ruleset.test", "bypass_actors.0.bypass_mode", "always"),
196204
),
197205
},
198206
},

website/docs/r/repository_ruleset.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,9 @@ The `rules` block supports the following:
296296

297297
#### bypass_actors ####
298298

299-
- `actor_id` - (Optional) (Number) The ID of the actor that can bypass a ruleset. If `actor_type` is `Integration`, `actor_id` is a GitHub App ID. App ID can be obtained by following instructions from the [Get an App API docs](https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#get-an-app). Some actor types such as `OrganizationAdmin` and `DeployKey` do not have an ID.
299+
- `actor_id` - (Optional) (Number) The ID of the actor that can bypass a ruleset. If `actor_type` is `Integration`, `actor_id` is a GitHub App ID. App ID can be obtained by following instructions from the [Get an App API docs](https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#get-an-app). Some actor types such as `OrganizationAdmin`, `EnterpriseOwner` and `DeployKey` do not have an ID.
300300

301-
- `actor_type` (String) The type of actor that can bypass a ruleset. Can be one of: `RepositoryRole`, `Team`, `Integration`, `OrganizationAdmin`, `DeployKey`.
301+
- `actor_type` (String) The type of actor that can bypass a ruleset. Can be one of: `RepositoryRole`, `Team`, `Integration`, `OrganizationAdmin`, `DeployKey`, `EnterpriseOwner`.
302302

303303
- `bypass_mode` - (Optional) (String) When the specified actor can bypass the ruleset. pull_request means that an actor can only bypass rules on pull requests. Can be one of: `always`, `pull_request`, `exempt`.
304304

0 commit comments

Comments
 (0)