keep fork default branch and CODEOWNERS, reject private forks
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/plan Pipeline was successful

This commit is contained in:
2026-11-19 22:24:19 +11:00
parent 3198f8d5d1
commit 361f34d820
4 changed files with 48 additions and 12 deletions
+6 -1
View File
@@ -100,7 +100,7 @@ variable "repository" {
type = map(object({
name = string
description = optional(string, "")
private = optional(bool, true)
private = optional(bool)
default_branch = optional(string, "main")
maintainers = optional(list(string), [])
codeowners = optional(list(string), [])
@@ -117,6 +117,11 @@ variable "repository" {
error_message = "fork_from must be \"<owner>/<repo>\": ${join(", ", [for name, repo in var.repository : name if repo.fork_from != null && !can(regex("^[^/]+/[^/]+$", coalesce(repo.fork_from, "-")))])}."
}
validation {
condition = alltrue([for repo in var.repository : !(repo.fork_from != null && repo.private == true)])
error_message = "private cannot be set on a fork, its visibility follows the source: ${join(", ", [for name, repo in var.repository : name if repo.fork_from != null && repo.private == true])}."
}
validation {
condition = alltrue([for repo in var.repository : contains(["squash", "merge", "rebase"], repo.merge_type)])
error_message = "merge_type must be squash, merge or rebase: ${join(", ", [for name, repo in var.repository : name if !contains(["squash", "merge", "rebase"], repo.merge_type)])}."