Skip to content

Commit 1647d38

Browse files
committed
remove actor_id for the org admin + ent owner cases where it should not be set according to the API docs https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/rules?apiVersion=2022-11-28#create-an-organization-repository-ruleset
1 parent b8bf8b3 commit 1647d38

4 files changed

Lines changed: 3 additions & 12 deletions

File tree

github/resource_github_organization_ruleset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func resourceGithubOrganizationRuleset() *schema.Resource {
6363
Type: schema.TypeInt,
6464
Optional: true,
6565
Default: nil,
66-
Description: "The ID of the actor that can bypass a ruleset. When `actor_type` is `OrganizationAdmin`, this should be set to `1`. When it is `EnterpriseOwner` it should be 0. Some resources such as DeployKey do not have an ID and this should be omitted.",
66+
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.",
6767
},
6868
"actor_type": {
6969
Type: schema.TypeString,

github/resource_github_organization_ruleset_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,11 @@ resource "github_organization_ruleset" "test" {
7272
}
7373
7474
bypass_actors {
75-
actor_id = 1
7675
actor_type = "OrganizationAdmin"
7776
bypass_mode = "always"
7877
}
7978
8079
bypass_actors {
81-
actor_id = 0
8280
actor_type = "EnterpriseOwner"
8381
bypass_mode = "always"
8482
}
@@ -173,10 +171,8 @@ resource "github_organization_ruleset" "test" {
173171
resource.TestCheckResourceAttr("github_organization_ruleset.test", "bypass_actors.1.actor_id", "5"),
174172
resource.TestCheckResourceAttr("github_organization_ruleset.test", "bypass_actors.1.actor_type", "RepositoryRole"),
175173
resource.TestCheckResourceAttr("github_organization_ruleset.test", "bypass_actors.1.bypass_mode", "always"),
176-
resource.TestCheckResourceAttr("github_organization_ruleset.test", "bypass_actors.2.actor_id", "1"),
177174
resource.TestCheckResourceAttr("github_organization_ruleset.test", "bypass_actors.2.actor_type", "OrganizationAdmin"),
178175
resource.TestCheckResourceAttr("github_organization_ruleset.test", "bypass_actors.2.bypass_mode", "always"),
179-
resource.TestCheckResourceAttr("github_organization_ruleset.test", "bypass_actors.3.actor_id", "0"),
180176
resource.TestCheckResourceAttr("github_organization_ruleset.test", "bypass_actors.3.actor_type", "EnterpriseOwner"),
181177
resource.TestCheckResourceAttr("github_organization_ruleset.test", "bypass_actors.3.bypass_mode", "always"),
182178
resource.TestCheckResourceAttr("github_organization_ruleset.test", "rules.0.pull_request.0.allowed_merge_methods.#", "3"),
@@ -636,7 +632,6 @@ resource "github_organization_ruleset" "test" {
636632
}
637633
638634
bypass_actors {
639-
actor_id = 1
640635
actor_type = "OrganizationAdmin"
641636
bypass_mode = "always"
642637
}
@@ -716,7 +711,6 @@ resource "github_organization_ruleset" "test" {
716711
enforcement = "active"
717712
718713
bypass_actors {
719-
actor_id = 1
720714
actor_type = "OrganizationAdmin"
721715
bypass_mode = "%s"
722716
}

website/docs/r/organization_ruleset.html.markdown

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,16 +349,14 @@ The `rules` block supports the following:
349349

350350
#### bypass_actors ####
351351

352-
- `actor_id` - (Optional) (Number) The ID of the actor that can bypass a ruleset. Some actor types such as `DeployKey` do not have an ID.
352+
- `actor_id` - (Optional) (Number) The ID of the actor that can bypass a ruleset. Some actor types such as `OrganizationAdmin`, `EnterpriseOwner` and `DeployKey` do not have an ID - this argument should not be set in those cases as the GitHub API will ignore it.
353353

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

356356
- `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`.
357357

358358
~>Note: at the time of writing this, the following actor types correspond to the following actor IDs:
359359

360-
- `EnterpriseOwner` -> `0`
361-
- `OrganizationAdmin` -> `1`
362360
- `RepositoryRole` (This is the actor type, the following are the base repository roles and their associated IDs.)
363361
- `maintain` -> `2`
364362
- `write` -> `4`

website/docs/r/repository_ruleset.html.markdown

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,14 @@ 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 `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` and `DeployKey` do not have an ID.
300300

301301
- `actor_type` (String) The type of actor that can bypass a ruleset. Can be one of: `RepositoryRole`, `Team`, `Integration`, `OrganizationAdmin`, `DeployKey`.
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

305305
~> Note: at the time of writing this, the following actor types correspond to the following actor IDs:
306306

307-
- `OrganizationAdmin` -> `1`
308307
- `RepositoryRole` (This is the actor type, the following are the base repository roles and their associated IDs.)
309308
- `maintain` -> `2`
310309
- `write` -> `4`

0 commit comments

Comments
 (0)