generate tag-protection ruleset for release tags
This commit is contained in:
@@ -46,8 +46,8 @@ variable "ruleset" {
|
||||
default = {}
|
||||
|
||||
validation {
|
||||
condition = length(setintersection(keys(var.ruleset), ["branch-protection", "required-checks"])) == 0
|
||||
error_message = "Ruleset names branch-protection and required-checks are reserved for generated rulesets."
|
||||
condition = length(setintersection(keys(var.ruleset), ["branch-protection", "required-checks", "tag-protection"])) == 0
|
||||
error_message = "Ruleset names branch-protection, required-checks and tag-protection are reserved for generated rulesets."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ variable "repository" {
|
||||
merge_type = optional(string, "squash")
|
||||
delete_branch_on_merge = optional(bool, true)
|
||||
branch_protection = optional(bool)
|
||||
tag_protection = optional(bool)
|
||||
required_checks = optional(list(string), [])
|
||||
rulesets = optional(list(string), [])
|
||||
}))
|
||||
@@ -78,6 +79,11 @@ variable "repository" {
|
||||
error_message = "branch_protection is not enforced on private repositories on the GitHub free plan: ${join(", ", [for name, repo in var.repository : name if repo.private && coalesce(repo.branch_protection, false)])}."
|
||||
}
|
||||
|
||||
validation {
|
||||
condition = alltrue([for repo in var.repository : !(repo.private && coalesce(repo.tag_protection, false))])
|
||||
error_message = "tag_protection is not enforced on private repositories on the GitHub free plan: ${join(", ", [for name, repo in var.repository : name if repo.private && coalesce(repo.tag_protection, false)])}."
|
||||
}
|
||||
|
||||
validation {
|
||||
condition = alltrue([for repo in var.repository : !(repo.private && length(repo.required_checks) > 0)])
|
||||
error_message = "required_checks are not enforced on private repositories on the GitHub free plan: ${join(", ", [for name, repo in var.repository : name if repo.private && length(repo.required_checks) > 0])}."
|
||||
|
||||
Reference in New Issue
Block a user