Skip to content

Commit

Permalink
branch protection can be switched off for private+free repos
Browse files Browse the repository at this point in the history
  • Loading branch information
morisil committed Sep 23, 2023
1 parent 3d67ced commit 81046de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions repository/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ resource "github_repository" "this" {
}

resource "github_branch_protection" "main" {
count = var.branch_protection ? 1 : 0
repository_id = github_repository.this.node_id
pattern = "main"
allows_deletions = false
Expand Down
6 changes: 6 additions & 0 deletions repository/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,9 @@ variable "topics" {
type = list(string)
default = null
}

variable "branch_protection" {
description = "Set to `true` to enable repository branch protection. For `private` repos on free plan it should be `false`"
type = bool
default = true
}

0 comments on commit 81046de

Please sign in to comment.