// CreateRepository makes API calls to create a normal repository or a derivative of a template
CreateRepository makes API calls to create a normal repository or a derivative of a template
// CreateRepository makes API calls to create a normal repository or a derivative of a template
func (e *external) CreateRepository(ctx context.Context, repository v1alpha1.RepositoryParameters, name string) error {
	if repository.Template == nil {
		repo := repositories.OverrideParameters(repository, github.Repository{}, name)
		_, _, err := e.gh.Create(
			ctx,
			ghclient.StringValue(repository.Organization),
			&repo,
		)
		return err
	}
	templateRef, err := repositories.SplitFullName(repository.Template.Name)
	if err != nil {
		return err
	}
	repo := repositories.GenerateTemplateRepoRequest(repository, name)
	_, res, err := e.gh.CreateFromTemplate(ctx, templateRef["owner"], templateRef["name"], &repo)
	if res.StatusCode == 404 {
		return errors.Wrap(err, errTemplateNotFound)
	}
	return err
}
func ( e * external ) CreateRepository ( ctx context . Context , repository v1alpha1 . RepositoryParameters , name string ) error { if repository . Template == nil { repo := repositories . OverrideParameters ( repository , github . Repository { } , name ) _ , _ , err := e . gh . Create ( ctx , ghclient . StringValue ( repository . Organization ) , & repo , ) return err } templateRef , err := repositories . SplitFullName ( repository . Template . Name ) if err != nil { return err } repo := repositories . GenerateTemplateRepoRequest ( repository , name ) _ , res , err := e . gh . CreateFromTemplate ( ctx , templateRef [ " " ] , templateRef [ " " ] , & repo ) if res . StatusCode == 404 { return errors . Wrap ( err , errTemplateNotFound ) } return err }
CreateRepository makes API calls to create a normal repository or a derivative of a template
CreateRepository makes API calls to create a normal repository or a derivative of a template