MCPcopy Index your code
hub / github.com/cli/cli / editRun

Function editRun

pkg/cmd/release/edit/edit.go:92–134  ·  view source on GitHub ↗
(tag string, opts *EditOptions)

Source from the content-addressed store, hash-verified

90}
91
92func editRun(tag string, opts *EditOptions) error {
93 httpClient, err := opts.HttpClient()
94 if err != nil {
95 return err
96 }
97
98 baseRepo, err := opts.BaseRepo()
99 if err != nil {
100 return err
101 }
102
103 release, err := shared.FetchRelease(context.Background(), httpClient, baseRepo, tag)
104 if err != nil {
105 return err
106 }
107
108 params := getParams(opts)
109
110 // If we don't provide any tag name, the API will remove the current tag from the release
111 if _, ok := params["tag_name"]; !ok {
112 params["tag_name"] = release.TagName
113 }
114
115 if opts.VerifyTag && opts.TagName != "" {
116 remoteTagPresent, err := remoteTagExists(httpClient, baseRepo, opts.TagName)
117 if err != nil {
118 return err
119 }
120 if !remoteTagPresent {
121 return fmt.Errorf("tag %s doesn't exist in the repo %s, aborting due to --verify-tag flag",
122 opts.TagName, ghrepo.FullName(baseRepo))
123 }
124 }
125
126 editedRelease, err := editRelease(httpClient, baseRepo, release.DatabaseID, params)
127 if err != nil {
128 return err
129 }
130
131 fmt.Fprintf(opts.IO.Out, "%s\n", editedRelease.URL)
132
133 return nil
134}
135
136func getParams(opts *EditOptions) map[string]interface{} {
137 params := map[string]interface{}{}

Callers 2

Test_editRunFunction · 0.70
NewCmdEditFunction · 0.70

Calls 7

FetchReleaseFunction · 0.92
FullNameFunction · 0.92
getParamsFunction · 0.85
editReleaseFunction · 0.85
remoteTagExistsFunction · 0.70
BaseRepoMethod · 0.65
ErrorfMethod · 0.65

Tested by 1

Test_editRunFunction · 0.56