@@ -261,22 +261,34 @@ export class BitbucketSCMLib extends SCMLib {
261
261
const repoRes = await this . bitbucketSdk . getRepo ( { repoUrl : this . url } )
262
262
return z . string ( ) . parse ( repoRes . mainbranch ?. name )
263
263
}
264
- getPrUrl ( prNumber : number ) : Promise < string > {
264
+ getSubmitRequestUrl ( submitRequestId : number ) : Promise < string > {
265
265
this . _validateUrl ( )
266
- const { repoSlug , workspace } = parseBitbucketOrganizationAndRepo ( this . url )
266
+ const { repo_slug , workspace } = parseBitbucketOrganizationAndRepo ( this . url )
267
267
return Promise . resolve (
268
- `https://bitbucket.org/${ workspace } /${ repoSlug } /pull-requests/${ prNumber } `
268
+ `https://bitbucket.org/${ workspace } /${ repo_slug } /pull-requests/${ submitRequestId } `
269
269
)
270
270
}
271
- async getPrId ( prUrl : string ) : Promise < string > {
272
- const match = prUrl . match ( / \/ p u l l - r e q u e s t s \/ ( \d + ) / )
271
+ async getSubmitRequestId ( submitRequestUrl : string ) : Promise < string > {
272
+ const match = submitRequestUrl . match ( / \/ p u l l - r e q u e s t s \/ ( \d + ) / )
273
273
return match ?. [ 1 ] || ''
274
274
}
275
275
getCommitUrl ( commitId : string ) : Promise < string > {
276
276
this . _validateUrl ( )
277
- const { repoSlug , workspace } = parseBitbucketOrganizationAndRepo ( this . url )
277
+ const { repo_slug , workspace } = parseBitbucketOrganizationAndRepo ( this . url )
278
278
return Promise . resolve (
279
- `https://bitbucket.org/${ workspace } /${ repoSlug } /commits/${ commitId } `
279
+ `https://bitbucket.org/${ workspace } /${ repo_slug } /commits/${ commitId } `
280
280
)
281
281
}
282
+
283
+ async addCommentToSubmitRequest (
284
+ submitRequestId : string ,
285
+ comment : string
286
+ ) : Promise < void > {
287
+ this . _validateUrl ( )
288
+ await this . bitbucketSdk . addCommentToPullRequest ( {
289
+ prNumber : Number ( submitRequestId ) ,
290
+ url : this . url ,
291
+ markdownComment : comment ,
292
+ } )
293
+ }
282
294
}
0 commit comments