Skip to content

Commit a894f55

Browse files
Fix empty string pointer handling in create_repository_from_template
- Only set owner and description if non-empty - Prevents sending empty strings to GitHub API which could be misinterpreted - All tests still pass Co-authored-by: SamMorrowDrums <[email protected]>
1 parent b32d68f commit a894f55

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/github/repositories.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,11 +690,17 @@ func CreateRepositoryFromTemplate(t translations.TranslationHelperFunc) inventor
690690

691691
templateReq := &github.TemplateRepoRequest{
692692
Name: github.Ptr(name),
693-
Owner: github.Ptr(owner),
694-
Description: github.Ptr(description),
695693
Private: github.Ptr(private),
696694
IncludeAllBranches: github.Ptr(includeAllBranches),
697695
}
696+
// Only set owner if provided (otherwise GitHub uses authenticated user)
697+
if owner != "" {
698+
templateReq.Owner = github.Ptr(owner)
699+
}
700+
// Only set description if provided (otherwise repository has no description)
701+
if description != "" {
702+
templateReq.Description = github.Ptr(description)
703+
}
698704

699705
client, err := deps.GetClient(ctx)
700706
if err != nil {

0 commit comments

Comments
 (0)