MCPcopy Create free account
hub / github.com/cli/cli / editRelease

Function editRelease

pkg/cmd/release/edit/http.go:17–37  ·  view source on GitHub ↗
(httpClient *http.Client, repo ghrepo.Interface, releaseID int64, params map[string]any)

Source from the content-addressed store, hash-verified

15)
16
17func 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
39func remoteTagExists(httpClient *http.Client, repo ghrepo.Interface, tagName string) (bool, error) {
40 gql := api.NewClientFromHTTP(httpClient)

Callers 3

editRunFunction · 0.85

Calls 7

JoinPathFunction · 0.92
NewClientFromHTTPFunction · 0.92
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
RESTMethod · 0.65
RepoHostMethod · 0.65
StringMethod · 0.65

Tested by 2