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

Function NewCmdCreate

pkg/cmd/release/create/create.go:67–226  ·  view source on GitHub ↗
(f *cmdutil.Factory, runF func(*CreateOptions) error)

Source from the content-addressed store, hash-verified

65}
66
67func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Command {
68 opts := &CreateOptions{
69 IO: f.IOStreams,
70 HttpClient: f.HttpClient,
71 GitClient: f.GitClient,
72 Config: f.Config,
73 Prompter: f.Prompter,
74 Edit: surveyext.Edit,
75 }
76
77 var notesFile string
78
79 cmd := &cobra.Command{
80 DisableFlagsInUseLine: true,
81
82 Use: "create [<tag>] [<filename>... | <pattern>...]",
83 Short: "Create a new release",
84 Long: heredoc.Docf(`
85 Create a new GitHub Release for a repository.
86
87 A list of asset files may be given to upload to the new release. To define a
88 display label for an asset, append text starting with %[1]s#%[1]s after the file name.
89
90 If a matching git tag does not yet exist, one will automatically get created
91 from the latest state of the default branch.
92 Use %[1]s--target%[1]s to point to a different branch or commit for the automatic tag creation.
93 Use %[1]s--verify-tag%[1]s to abort the release if the tag doesn't already exist.
94 To fetch the new tag locally after the release, do %[1]sgit fetch --tags origin%[1]s.
95
96 To create a release from an annotated git tag, first create one locally with
97 git, push the tag to GitHub, then run this command.
98 Use %[1]s--notes-from-tag%[1]s to get the release notes from the annotated git tag.
99 If the tag is not annotated, the commit message will be used instead.
100
101 Use %[1]s--generate-notes%[1]s to automatically generate notes using GitHub Release Notes API.
102 When using automatically generated release notes, a release title will also be automatically
103 generated unless a title was explicitly passed. Additional release notes can be prepended to
104 automatically generated notes by using the %[1]s--notes%[1]s flag.
105
106 By default, the release is created even if there are no new commits since the last release.
107 This may result in the same or duplicate release which may not be desirable in some cases.
108 Use %[1]s--fail-on-no-commits%[1]s to fail if no new commits are available. This flag has no
109 effect if there are no existing releases or this is the very first release.
110
111 ## Immutable Releases
112
113 When release immutability is enabled for a repository, the following protections are enforced:
114 - Git tags associated with a release cannot be modified or deleted.
115 - Release assets cannot be modified or deleted.
116
117 Immutability is enforced only after a release is published. Draft releases can be modified
118 or deleted, and the associated git tags can be modified or deleted as well.
119
120 When using the %[1]screate%[1]s command to attach assets to a release, separate API calls
121 are made to create the release as a draft, upload the assets, and then publish the release.
122 Immutability protections will be enforced ONLY after the release is published.
123 `, "`"),
124 Example: heredoc.Doc(`

Callers 1

Test_NewCmdCreateFunction · 0.70

Calls 8

AssetsFromArgsFunction · 0.92
FlagErrorfFunction · 0.92
ReadFileFunction · 0.92
NilBoolFlagFunction · 0.92
ChangedMethod · 0.80
CanPromptMethod · 0.80
createRunFunction · 0.70

Tested by 1

Test_NewCmdCreateFunction · 0.56