generate tag-protection ruleset for release tags
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/plan Pipeline was successful

This commit is contained in:
2026-11-10 21:56:48 +11:00
parent 132e93c0d4
commit d7359d1fc7
4 changed files with 83 additions and 8 deletions
+8 -2
View File
@@ -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])}."