Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions github/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,11 +580,12 @@

// TemplateRepoRequest represents a request to create a repository from a template.
type TemplateRepoRequest struct {
Name string `json:"name"`
Owner *string `json:"owner,omitempty"`
Description *string `json:"description,omitempty"`
IncludeAllBranches *bool `json:"include_all_branches,omitempty"`
Private *bool `json:"private,omitempty"`
Name string `json:"name"`
Owner *string `json:"owner,omitempty"`
Description *string `json:"description,omitempty"`
IncludeAllBranches *bool `json:"include_all_branches,omitempty"`
Private *bool `json:"private,omitempty"`
CustomProperties map[string]any `json:"custom_properties,omitempty"`

Check warning on line 588 in github/repos.go

View workflow job for this annotation

GitHub Actions / check-openapi

TemplateRepoRequest.CustomProperties

Go field is not in the request body schema of any of its 1 operation(s)
}

// CreateFromTemplate generates a repository from a template.
Expand Down
7 changes: 6 additions & 1 deletion github/repos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,17 @@ func TestRepositoriesService_CreateFromTemplate(t *testing.T) {

templateRepoReq := TemplateRepoRequest{
Name: "n",
CustomProperties: map[string]any{
"environment": "production",
"team": "backend",
"priority": 1,
},
}

mux.HandleFunc("/repos/to/tr/generate", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
testHeader(t, r, "Accept", mediaTypeRepositoryTemplatePreview)
testJSONBody(t, r, templateRepoReq)
testJSONBodyRaw(t, r, `{"name":"n","custom_properties":{"environment":"production","team":"backend","priority":1}}`)
fmt.Fprint(w, `{"id":1,"name":"n"}`)
})

Expand Down
Loading