rename auto-init main to default_branch and reject invalid ruleset shapes
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/plan Pipeline was successful

This commit is contained in:
2026-11-10 22:01:33 +11:00
parent d7359d1fc7
commit 23c315a49a
3 changed files with 76 additions and 0 deletions
@@ -230,3 +230,66 @@ run "unknown_ruleset_rejected" {
expect_failures = [var.repository]
}
run "non_main_default_branch_renamed" {
command = plan
variables {
repository = {
legacy = { name = "legacy", default_branch = "master", maintainers = ["carol"] }
}
}
assert {
condition = (
github_branch_default.this["legacy"].branch == "master" &&
github_branch_default.this["legacy"].rename &&
github_branch_default.this["legacy"].wait_for_rename
)
error_message = "default_branch must rename the auto-init main and wait for it to propagate"
}
assert {
condition = github_repository_file.codeowners["legacy"].branch == "master"
error_message = "CODEOWNERS must be committed to the renamed default branch"
}
}
run "tag_ruleset_pull_request_rejected" {
command = plan
variables {
ruleset = {
tagpr = { name = "tagpr", target = "tag", rules = { pull_request = {} } }
}
repository = {}
}
expect_failures = [var.ruleset]
}
run "tag_ruleset_status_checks_rejected" {
command = plan
variables {
ruleset = {
tagci = { name = "tagci", target = "tag", rules = { required_status_checks = { contexts = ["ci"] } } }
}
repository = {}
}
expect_failures = [var.ruleset]
}
run "empty_status_check_contexts_rejected" {
command = plan
variables {
ruleset = {
noci = { name = "noci", rules = { required_status_checks = { contexts = [] } } }
}
repository = {}
}
expect_failures = [var.ruleset]
}