···303303304304// GenerateRepoOptions contains the template units to generate
305305type GenerateRepoOptions struct {
306306- Name string
307307- DefaultBranch string
308308- Description string
309309- Private bool
310310- GitContent bool
311311- Topics bool
312312- GitHooks bool
313313- Webhooks bool
314314- Avatar bool
315315- IssueLabels bool
306306+ Name string
307307+ DefaultBranch string
308308+ Description string
309309+ Private bool
310310+ GitContent bool
311311+ Topics bool
312312+ GitHooks bool
313313+ Webhooks bool
314314+ Avatar bool
315315+ IssueLabels bool
316316+ ProtectedBranch bool
316317}
317318318319// IsValid checks whether at least one option is chosen for generation
319320func (gro GenerateRepoOptions) IsValid() bool {
320320- return gro.GitContent || gro.Topics || gro.GitHooks || gro.Webhooks || gro.Avatar || gro.IssueLabels // or other items as they are added
321321+ return gro.GitContent || gro.Topics || gro.GitHooks || gro.Webhooks || gro.Avatar ||
322322+ gro.IssueLabels || gro.ProtectedBranch // or other items as they are added
321323}
322324323325// GenerateRepository generates a repository from a template
+2
modules/structs/repo.go
···238238 Avatar bool `json:"avatar"`
239239 // include labels in template repo
240240 Labels bool `json:"labels"`
241241+ // include protected branches in template repo
242242+ ProtectedBranch bool `json:"protected_branch"`
241243}
242244243245// CreateBranchRepoOption options when creating a branch in a repository