fix(release): discussion category with assets
This commit is contained in:
parent
eaa64df801
commit
015b9f7fea
2 changed files with 9 additions and 3 deletions
|
|
@ -418,7 +418,12 @@ func createRun(opts *CreateOptions) error {
|
|||
}
|
||||
|
||||
if !opts.Draft {
|
||||
rel, err := publishRelease(httpClient, newRelease.APIURL)
|
||||
params := map[string]interface{}{}
|
||||
params["draft"] = false
|
||||
if opts.DiscussionCategory != "" {
|
||||
params["discussion_category_name"] = opts.DiscussionCategory
|
||||
}
|
||||
rel, err := publishRelease(httpClient, newRelease.APIURL, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,8 +134,9 @@ func createRelease(httpClient *http.Client, repo ghrepo.Interface, params map[st
|
|||
return &newRelease, err
|
||||
}
|
||||
|
||||
func publishRelease(httpClient *http.Client, releaseURL string) (*shared.Release, error) {
|
||||
req, err := http.NewRequest("PATCH", releaseURL, bytes.NewBufferString(`{"draft":false}`))
|
||||
func publishRelease(httpClient *http.Client, releaseURL string, params map[string]interface{}) (*shared.Release, error) {
|
||||
bodyBytes, err := json.Marshal(params)
|
||||
req, err := http.NewRequest("PATCH", releaseURL, bytes.NewBuffer(bodyBytes))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue