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

chore: switch to ruleset for "example" #270

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 45 additions & 28 deletions example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,54 @@ resource "github_repository" "example" {
}
}

resource "github_branch_protection" "example-main" {
repository_id = github_repository.example.node_id

pattern = "main"
enforce_admins = true
allows_deletions = false
require_signed_commits = false
required_linear_history = true
require_conversation_resolution = true
allows_force_pushes = false
lock_branch = false

required_status_checks {
strict = false
contexts = ["build", "install", "lint", "test"]
}

required_pull_request_reviews {
dismiss_stale_reviews = true
restrict_dismissals = false
resource "github_repository_ruleset" "example-main" {
enforcement = "active"
name = "default-branch-protection"
repository = github_repository.example.name
target = "branch"

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

resource "github_branch_protection" "example-gh-pages" {
repository_id = github_repository.example.node_id
rules {
creation = true
deletion = true
non_fast_forward = true
required_linear_history = true
required_signatures = false
update = false
update_allows_fetch_and_merge = false

pull_request {
dismiss_stale_reviews_on_push = true
require_code_owner_review = false
require_last_push_approval = false
required_approving_review_count = 1
required_review_thread_resolution = true
}

pattern = "gh-pages"
enforce_admins = true
allows_deletions = false
required_linear_history = true
allows_force_pushes = false
required_status_checks {
do_not_enforce_on_create = false
strict_required_status_checks_policy = false

required_check {
context = "install"
}
required_check {
context = "lint"
}
required_check {
context = "test"
}
required_check {
context = "build"
}
}
}
}

resource "github_repository_collaborators" "example" {
Expand Down