archive github repos on destroy, reject unknown rulesets
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/plan Pipeline was successful

This commit is contained in:
2026-11-10 00:05:34 +11:00
parent 323cde9336
commit a99c8f04fd
3 changed files with 18 additions and 0 deletions
+1
View File
@@ -50,6 +50,7 @@ resource "github_repository" "this" {
allow_rebase_merge = each.value.allow_rebase_merge
delete_branch_on_merge = each.value.delete_branch_on_merge
auto_init = each.value.auto_init
archive_on_destroy = true
}
resource "github_branch_default" "this" {
@@ -65,3 +65,15 @@ run "private_repo_with_ruleset_rejected" {
expect_failures = [var.repository]
}
run "unknown_ruleset_rejected" {
command = plan
variables {
repository = {
public = { name = "public", private = false, rulesets = ["missing"] }
}
}
expect_failures = [var.repository]
}
+5
View File
@@ -71,4 +71,9 @@ variable "repository" {
condition = alltrue([for repo in var.repository : !(repo.private && length(repo.rulesets) > 0)])
error_message = "Rulesets are not enforced on private repositories on the GitHub free plan: ${join(", ", [for name, repo in var.repository : name if repo.private && length(repo.rulesets) > 0])}."
}
validation {
condition = alltrue(flatten([for repo in var.repository : [for rs in repo.rulesets : contains(keys(var.ruleset), rs)]]))
error_message = "Unknown rulesets referenced: ${join(", ", distinct(flatten([for name, repo in var.repository : [for rs in repo.rulesets : "${name}/${rs}" if !contains(keys(var.ruleset), rs)]])))}."
}
}