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 #2255

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

megamih
Copy link

@megamih megamih commented May 5, 2024

Resolves #2254


Before the change?

  • 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

After the change?

  • Terraform GitHub provider supports Deploy keys for bypass access:
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # github_organization_ruleset.test will be created
  + resource "github_organization_ruleset" "test" {
  ...
      + bypass_actors {
          + actor_id    = 0
          + actor_type  = "DeployKey"
          + bypass_mode = "always"
        }
  ...
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT]: Add DeployKey to bypass_actors in github_organization_ruleset and github_repository_ruleset
2 participants