add fork_from to github repositories
This commit is contained in:
@@ -111,6 +111,53 @@ run "merge_type_rebase" {
|
||||
}
|
||||
}
|
||||
|
||||
run "fork_from_source" {
|
||||
command = plan
|
||||
|
||||
variables {
|
||||
repository = {
|
||||
autocraft = { name = "autocraft", fork_from = "storytold/autocraft", maintainers = ["@maintainers"] }
|
||||
plain = { name = "plain" }
|
||||
}
|
||||
}
|
||||
|
||||
assert {
|
||||
condition = (
|
||||
module.repository["autocraft"].repository.fork == "true" &&
|
||||
module.repository["autocraft"].repository.source_owner == "storytold" &&
|
||||
module.repository["autocraft"].repository.source_repo == "autocraft" &&
|
||||
!module.repository["autocraft"].repository.auto_init
|
||||
)
|
||||
error_message = "fork_from must fork the source repository without auto_init"
|
||||
}
|
||||
|
||||
assert {
|
||||
condition = keys(module.ruleset) == ["autocraft/branch-protection", "autocraft/ref-names-tag", "autocraft/tag-protection", "plain/branch-protection", "plain/ref-names-tag", "plain/tag-protection"] && module.repository["autocraft"].codeowners != null
|
||||
error_message = "forks get the org rulesets and CODEOWNERS like any other repository"
|
||||
}
|
||||
|
||||
assert {
|
||||
condition = (
|
||||
module.repository["plain"].repository.auto_init &&
|
||||
module.repository["plain"].repository.visibility == "private" &&
|
||||
module.repository["autocraft"].repository.allow_squash_merge
|
||||
)
|
||||
error_message = "non-forks keep auto_init and configured visibility; forks keep repo settings"
|
||||
}
|
||||
}
|
||||
|
||||
run "invalid_fork_from_rejected" {
|
||||
command = plan
|
||||
|
||||
variables {
|
||||
repository = {
|
||||
bad = { name = "bad", fork_from = "storytold" }
|
||||
}
|
||||
}
|
||||
|
||||
expect_failures = [var.repository]
|
||||
}
|
||||
|
||||
run "invalid_merge_type_rejected" {
|
||||
command = plan
|
||||
|
||||
|
||||
Reference in New Issue
Block a user