Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT]: Add DeployKey to bypass_actors in github_organization_ruleset and github_repository_ruleset #2254

Open
megamih opened this issue May 5, 2024 · 0 comments · May be fixed by #2255
Open
Labels
Status: Triage This is being looked at and prioritized Type: Feature New feature or request

Comments

@megamih
Copy link

megamih commented May 5, 2024

Describe the need

According to GitHub docummentation for creating rulesets for repositories in your organization and REST API for managing rulesets for organizations and repositories the following are eligible for bypass access:

  • Repository admins or organization owners
  • The maintain or write role, or custom repository roles based on the write role
  • Teams
  • Deploy keys
  • GitHub Apps
  • Dependabot

And Terraform GitHub provider lacks support for Deploy keys.

resource "github_organization_ruleset" "test" {
	name        = "test-%s"
	target      = "branch"
	enforcement = "active"

	conditions {
		ref_name {
			include = ["~ALL"]
			exclude = []
		}
	}

	bypass_actors {
		actor_id    = 0
		actor_type  = "DeployKey"
		bypass_mode = "always"
	}

	rules {
		creation = true

		update = true

		deletion                = true
		required_linear_history = true

		required_signatures = false

		pull_request {
			required_approving_review_count   = 2
			required_review_thread_resolution = true
			require_code_owner_review         = true
			dismiss_stale_reviews_on_push     = true
			require_last_push_approval        = true
		}

		required_status_checks {

			required_check {
				context = "ci"
			}

			strict_required_status_checks_policy = true
		}

		branch_name_pattern {
			name     = "test"
			negate   = false
			operator = "starts_with"
			pattern  = "test"
		}

		non_fast_forward = true
	}
}

returns an error

│ Error: expected bypass_actors.0.actor_type to be one of [RepositoryRole Team Integration OrganizationAdmin], got DeployKey

SDK Version

No response

API Version

2022-11-28

Relevant log output

│ Error: expected bypass_actors.0.actor_type to be one of [RepositoryRole Team Integration OrganizationAdmin], got DeployKey


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
@megamih megamih added Status: Triage This is being looked at and prioritized Type: Feature New feature or request labels May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage This is being looked at and prioritized Type: Feature New feature or request
Projects
None yet
1 participant