@@ -53,6 +53,8 @@ type CreateOptions struct {
5353 Labels []string
5454 Projects []string
5555 Milestone string
56+
57+ MaintainerCanModify bool
5658}
5759
5860type CreateContext struct {
@@ -91,6 +93,10 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co
9193
9294 A prompt will also ask for the title and the body of the pull request. Use '--title'
9395 and '--body' to skip this, or use '--fill' to autofill these values from git commits.
96+
97+ By default users with write access to the base respository can add new commits to your branch.
98+ If undesired, you may disable access of maintainers by using '--no-maintainer-edit'
99+ You can always change this setting later via the web interface.
94100 ` ),
95101 Example : heredoc .Doc (`
96102 $ gh pr create --title "The bug is fixed" --body "Everything works again"
@@ -103,6 +109,8 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co
103109 opts .TitleProvided = cmd .Flags ().Changed ("title" )
104110 opts .BodyProvided = cmd .Flags ().Changed ("body" )
105111 opts .RepoOverride , _ = cmd .Flags ().GetString ("repo" )
112+ noMaintainerEdit , _ := cmd .Flags ().GetBool ("no-maintainer-edit" )
113+ opts .MaintainerCanModify = ! noMaintainerEdit
106114
107115 if ! opts .IO .CanPrompt () && opts .RecoverFile != "" {
108116 return & cmdutil.FlagError {Err : errors .New ("--recover only supported when running interactively" )}
@@ -118,6 +126,9 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co
118126 if len (opts .Reviewers ) > 0 && opts .WebMode {
119127 return errors .New ("the --reviewer flag is not supported with --web" )
120128 }
129+ if cmd .Flags ().Changed ("no-maintainer-edit" ) && opts .WebMode {
130+ return errors .New ("the --no-maintainer-edit flag is not supported with --web" )
131+ }
121132
122133 if runF != nil {
123134 return runF (opts )
@@ -139,6 +150,7 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co
139150 fl .StringSliceVarP (& opts .Labels , "label" , "l" , nil , "Add labels by `name`" )
140151 fl .StringSliceVarP (& opts .Projects , "project" , "p" , nil , "Add the pull request to projects by `name`" )
141152 fl .StringVarP (& opts .Milestone , "milestone" , "m" , "" , "Add the pull request to a milestone by `name`" )
153+ fl .Bool ("no-maintainer-edit" , false , "Disable maintainer's ability to modify pull request" )
142154 fl .StringVar (& opts .RecoverFile , "recover" , "" , "Recover input from a failed run of create" )
143155
144156 return cmd
@@ -561,11 +573,12 @@ func submitPR(opts CreateOptions, ctx CreateContext, state shared.IssueMetadataS
561573 client := ctx .Client
562574
563575 params := map [string ]interface {}{
564- "title" : state .Title ,
565- "body" : state .Body ,
566- "draft" : state .Draft ,
567- "baseRefName" : ctx .BaseBranch ,
568- "headRefName" : ctx .HeadBranchLabel ,
576+ "title" : state .Title ,
577+ "body" : state .Body ,
578+ "draft" : state .Draft ,
579+ "baseRefName" : ctx .BaseBranch ,
580+ "headRefName" : ctx .HeadBranchLabel ,
581+ "maintainerCanModify" : opts .MaintainerCanModify ,
569582 }
570583
571584 if params ["title" ] == "" {
0 commit comments