File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -395,7 +395,11 @@ export class GitLabRemote extends RemoteProvider<GitLabRepositoryDescriptor> {
395395 protected override async getUrlForCreatePullRequest (
396396 base : { branch ?: string ; remote : { path : string ; url : string } } ,
397397 head : { branch : string ; remote : { path : string ; url : string } } ,
398- options ?: { title ?: string ; description ?: string } ,
398+ options ?: {
399+ title ?: string ;
400+ description ?: string ;
401+ describePullRequest ?: ( ) => Promise < { summary : string ; body : string } | undefined > ;
402+ } ,
399403 ) : Promise < string | undefined > {
400404 const query = new URLSearchParams ( {
401405 utf8 : '✓' ,
@@ -425,6 +429,15 @@ export class GitLabRemote extends RemoteProvider<GitLabRepositoryDescriptor> {
425429 if ( options ?. description ) {
426430 query . set ( 'merge_request[description]' , options . description ) ;
427431 }
432+ if ( ( ! options ?. title || ! options ?. description ) && options ?. describePullRequest ) {
433+ const result = await options . describePullRequest ( ) ;
434+ if ( result ?. summary ) {
435+ query . set ( 'merge_request[title]' , result . summary ) ;
436+ }
437+ if ( result ?. body ) {
438+ query . set ( 'merge_request[description]' , result . body ) ;
439+ }
440+ }
428441
429442 return `${ this . encodeUrl ( `${ this . getRepoBaseUrl ( head . remote . path ) } /-/merge_requests/new` ) } ?${ query . toString ( ) } ` ;
430443 }
You can’t perform that action at this time.
0 commit comments