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

Protect Bucket4j main branch #293

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions terraform-scripts/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ data "github_team" "quarkiverse_members" {
slug = "quarkiverse-members"
}

data "github_app" "quarkiverse_ci" {
slug = "quarkiverse-ci"
}

locals {
# Application IDs installed in the Quarkiverse organization
# These applications are enabled on a per-repository basis
Expand Down
33 changes: 33 additions & 0 deletions terraform-scripts/quarkus-bucket4j.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ resource "github_repository" "quarkus_bucket4j" {
name = "quarkus-bucket4j"
description = "Java rate limiting library based on token-bucket algorithm Quarkus extension"
homepage_url = "https://bucket4j.com/"
allow_merge_commit = false
allow_rebase_merge = false
allow_update_branch = true
archive_on_destroy = true
delete_branch_on_merge = true
Expand Down Expand Up @@ -35,3 +37,34 @@ resource "github_team_membership" "quarkus_bucket4j" {
username = each.value
role = "maintainer"
}

# Protect main branch using a ruleset
resource "github_repository_ruleset" "quarkus_bucket4j" {
name = "main"
repository = github_repository.quarkus_bucket4j.name
target = "branch"
enforcement = "active"

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

bypass_actors {
actor_id = data.github_app.quarkiverse_ci.id
actor_type = "Integration"
bypass_mode = "always"
}

rules {
# Prevent force push
non_fast_forward = true
# Require pull request reviews before merging
pull_request {

}
}
}