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

Function createRun

pkg/cmd/release/create/create.go:231–571  ·  view source on GitHub ↗
(opts *CreateOptions)

Source from the content-addressed store, hash-verified

229}
230
231func createRun(opts *CreateOptions) error {
232 httpClient, err := opts.HttpClient()
233 if err != nil {
234 return err
235 }
236
237 baseRepo, err := opts.BaseRepo()
238 if err != nil {
239 return err
240 }
241
242 if opts.FailOnNoCommits {
243 isNew, err := isNewRelease(httpClient, baseRepo)
244 if err != nil {
245 return fmt.Errorf("failed to check whether there were new commits since last release: %v", err)
246 }
247 if !isNew {
248 return fmt.Errorf("no new commits since the last release")
249 }
250 }
251
252 var existingTag bool
253 if opts.TagName == "" {
254 tags, err := getTags(httpClient, baseRepo, 5)
255 if err != nil {
256 return err
257 }
258
259 if len(tags) != 0 {
260 options := make([]string, len(tags))
261 for i, tag := range tags {
262 options[i] = tag.Name
263 }
264 createNewTagOption := "Create a new tag"
265 options = append(options, createNewTagOption)
266 selected, err := opts.Prompter.Select("Choose a tag", options[0], options)
267 if err != nil {
268 return fmt.Errorf("could not prompt: %w", err)
269 }
270 tag := options[selected]
271 if tag != createNewTagOption {
272 existingTag = true
273 opts.TagName = tag
274 }
275 }
276
277 if opts.TagName == "" {
278 opts.TagName, err = opts.Prompter.Input("Tag name", "")
279 if err != nil {
280 return fmt.Errorf("could not prompt: %w", err)
281 }
282 opts.TagName = strings.TrimSpace(opts.TagName)
283 }
284 }
285
286 if opts.VerifyTag && !existingTag {
287 remoteTagPresent, err := remoteTagExists(httpClient, baseRepo, opts.TagName)
288 if err != nil {

Callers 3

Test_createRunFunction · 0.70
NewCmdCreateFunction · 0.70

Calls 15

FullNameFunction · 0.92
DetermineEditorFunction · 0.92
NewImmutableSafeURLFunction · 0.92
ConcurrentUploadFunction · 0.92
isNewReleaseFunction · 0.85
getTagsFunction · 0.85
gitTagInfoFunction · 0.85
generateReleaseNotesFunction · 0.85
changelogForRangeFunction · 0.85
generateChangelogFunction · 0.85
detectPreviousTagFunction · 0.85
publishedReleaseExistsFunction · 0.85

Tested by 2

Test_createRunFunction · 0.56