MCPcopy
hub / github.com/cli/cli / NewCmdCreate

Function NewCmdCreate

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

Source from the content-addressed store, hash-verified

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

Callers 1

Test_NewCmdCreateFunction · 0.70

Calls 7

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

Tested by 1

Test_NewCmdCreateFunction · 0.56