@@ -60,9 +60,7 @@ export class GitLabProvider extends GitProvider {
6060 if ( options . head ) params . set ( "source_branch" , options . head ) ;
6161 if ( options . label ) params . set ( "labels" , options . label ) ;
6262
63- const mrs = await this . api < GitLabMrResponse [ ] > (
64- `/projects/${ this . projectPath } /merge_requests?${ params } ` ,
65- ) ;
63+ const mrs = await this . api < GitLabMrResponse [ ] > ( `/projects/${ this . projectPath } /merge_requests?${ params } ` ) ;
6664
6765 if ( ! mrs [ 0 ] ) return null ;
6866 return this . mapMrResponse ( mrs [ 0 ] ) ;
@@ -83,10 +81,10 @@ export class GitLabProvider extends GitProvider {
8381 body . labels = options . labels . join ( "," ) ;
8482 }
8583
86- const data = await this . api < GitLabMrResponse > (
87- `/projects/ ${ this . projectPath } /merge_requests` ,
88- { body : JSON . stringify ( body ) , method : "POST" } ,
89- ) ;
84+ const data = await this . api < GitLabMrResponse > ( `/projects/ ${ this . projectPath } /merge_requests` , {
85+ body : JSON . stringify ( body ) ,
86+ method : "POST" ,
87+ } ) ;
9088
9189 return this . mapMrResponse ( data ) ;
9290 }
@@ -96,17 +94,15 @@ export class GitLabProvider extends GitProvider {
9694 if ( options . title ) body . title = options . title ;
9795 if ( options . body ) body . description = options . body ;
9896
99- await this . api (
100- `/projects/ ${ this . projectPath } /merge_requests/ ${ number } ` ,
101- { body : JSON . stringify ( body ) , method : "PUT" } ,
102- ) ;
97+ await this . api ( `/projects/ ${ this . projectPath } /merge_requests/ ${ number } ` , {
98+ body : JSON . stringify ( body ) ,
99+ method : "PUT" ,
100+ } ) ;
103101 }
104102
105103 async getPr ( number : number ) : Promise < PullRequest > {
106104 try {
107- const data = await this . api < GitLabMrResponse > (
108- `/projects/${ this . projectPath } /merge_requests/${ number } ` ,
109- ) ;
105+ const data = await this . api < GitLabMrResponse > ( `/projects/${ this . projectPath } /merge_requests/${ number } ` ) ;
110106 return this . mapMrResponse ( data ) ;
111107 } catch {
112108 throw new Exit ( `Failed to fetch MR !${ number } ` , "Make sure the MR exists and you have access" ) ;
@@ -119,9 +115,7 @@ export class GitLabProvider extends GitProvider {
119115 const branch = result . stdout . toString ( ) . trim ( ) ;
120116
121117 const params = new URLSearchParams ( { per_page : "1" , source_branch : branch , state : "opened" } ) ;
122- const mrs = await this . api < GitLabMrResponse [ ] > (
123- `/projects/${ this . projectPath } /merge_requests?${ params } ` ,
124- ) ;
118+ const mrs = await this . api < GitLabMrResponse [ ] > ( `/projects/${ this . projectPath } /merge_requests?${ params } ` ) ;
125119
126120 if ( ! mrs [ 0 ] ) throw new Error ( "No MR found" ) ;
127121 return this . mapMrResponse ( mrs [ 0 ] ) ;
@@ -158,29 +152,20 @@ export class GitLabProvider extends GitProvider {
158152 if ( options ?. description ) body . description = options . description ;
159153 if ( options ?. color ) body . color = `#${ options . color } ` ;
160154
161- await this . api ( `/projects/${ this . projectPath } /labels` , {
162- body : JSON . stringify ( body ) ,
163- method : "POST" ,
164- } ) ;
155+ await this . api ( `/projects/${ this . projectPath } /labels` , { body : JSON . stringify ( body ) , method : "POST" } ) ;
165156 } catch { }
166157 }
167158
168159 async createRelease ( options : CreateReleaseOptions ) : Promise < void > {
169160 await this . api ( `/projects/${ this . projectPath } /releases` , {
170- body : JSON . stringify ( {
171- description : options . notes ,
172- name : options . title ,
173- tag_name : options . tag ,
174- } ) ,
161+ body : JSON . stringify ( { description : options . notes , name : options . title , tag_name : options . tag } ) ,
175162 method : "POST" ,
176163 } ) ;
177164 }
178165
179166 async deleteRelease ( tag : string ) : Promise < void > {
180167 try {
181- await this . api ( `/projects/${ this . projectPath } /releases/${ encodeURIComponent ( tag ) } ` , {
182- method : "DELETE" ,
183- } ) ;
168+ await this . api ( `/projects/${ this . projectPath } /releases/${ encodeURIComponent ( tag ) } ` , { method : "DELETE" } ) ;
184169 } catch { }
185170 }
186171
@@ -204,11 +189,7 @@ export class GitLabProvider extends GitProvider {
204189 private async api < T > ( path : string , options ?: RequestInit ) : Promise < T > {
205190 const response = await fetch ( `${ this . apiUrl } ${ path } ` , {
206191 ...options ,
207- headers : {
208- "Content-Type" : "application/json" ,
209- ...this . authHeader ,
210- ...options ?. headers ,
211- } ,
192+ headers : { "Content-Type" : "application/json" , ...this . authHeader , ...options ?. headers } ,
212193 } ) ;
213194
214195 if ( ! response . ok ) {
0 commit comments