github_org: support forking repositories via fork_from #135
Reference in New Issue
Block a user
Delete Branch "benvin/github-fork-support"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
GitHub repositories in
modules/github_orgcan only be created empty, so mirroring an upstream project as an org-managed fork is not possible.fork_from: owner/repoto repository yaml, forking a public upstreamprivateon forksfork_fromand its constraints in the READMErename = trueagainstdefault_branch(defaultmain) renames the fork's inherited default branch when the source uses another (e.g.master), diverging it from upstream → requiredefault_branchto match the source (validate/document), or setrename = local.fork_source == nullfor forks..github/CODEOWNERS(overwrite_on_create = false) → rejectmaintainerswithfork_from, or skip the file for forks.privateis silently ignored whenfork_fromis set (visibility = null) → add a validation rejectingprivate = truewithfork_from(gitea module does the same for conflicting attributes).fork_fromto an existing non-fork repo is ForceNew (forkfalse→true) andarchive_on_destroymakes the recreate fail on the name clash → note in the description thatfork_fromis create-time only.private = falseon a fork is accepted but silently ignored (visibility is null for forks), and thepublictest case locks that in → reject any non-nullprivatewhenfork_fromis set (repo.private != null) and dropprivate = falsefrom the test.visibility = nullon a new fork the provider (v6.13.0calculateVisibility) falls back to "public" and issues a visibility Edit after CreateFork; fine for a public source, fails for a private source → state in the PR body/README thatfork_frommust be a public repo, or confirm storytold/autocraft is public.fork_fromis not → add it.unkin-agent referenced this pull request2026-11-19 22:26:38 +11:00
fork_fromto an existing repository recreates it" is wrong in practice:forkfalse→true forces replacement, butarchive_on_destroy = trueonly archives the old repo, so the new fork hits a name collision (GitHub suffixes the name, provider then drifts) → state that the existing repo must be deleted on GitHub (orstate rm) before addingfork_from.private: true, but the default is now unset (true only for non-forks) → annotate# default true; omit on forks.No findings.