| 15 | ) |
| 16 | |
| 17 | func editRelease(httpClient *http.Client, repo ghrepo.Interface, releaseID int64, params map[string]any) (*shared.Release, error) { |
| 18 | bodyBytes, err := json.Marshal(params) |
| 19 | if err != nil { |
| 20 | return nil, err |
| 21 | } |
| 22 | |
| 23 | path, err := safeurl.JoinPath("repos", repo.RepoOwner(), repo.RepoName(), "releases", strconv.FormatInt(releaseID, 10)) |
| 24 | if err != nil { |
| 25 | return nil, err |
| 26 | } |
| 27 | |
| 28 | var newRelease shared.Release |
| 29 | // TODO(api-client-rollout) |
| 30 | // This line of code is part of a mechanical roll out of the api client. |
| 31 | // As a follow up, consider whether the api client can be injected to this call site, rather than constructed |
| 32 | if err := api.NewClientFromHTTP(httpClient).REST(repo.RepoHost(), http.MethodPatch, path.String(), bytes.NewBuffer(bodyBytes), &newRelease); err != nil { |
| 33 | return nil, err |
| 34 | } |
| 35 | |
| 36 | return &newRelease, nil |
| 37 | } |
| 38 | |
| 39 | func remoteTagExists(httpClient *http.Client, repo ghrepo.Interface, tagName string) (bool, error) { |
| 40 | gql := api.NewClientFromHTTP(httpClient) |