File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 11const azdev = require ( 'azure-devops-node-api' ) ;
22
3+ /**
4+ * Gets PR's link from pull request id - since url property of GitPullRequest returns JSON
5+ */
6+ function getPullRequestLink ( repositoryWebUrl , pullRequestId ) {
7+ return `${ repositoryWebUrl } /pullrequest/${ pullRequestId } ` ;
8+ }
9+
310const orgUrl = "https://dev.azure.com/mseng" ;
411const token = process . env . TOKEN ;
512if ( ! token ) {
@@ -27,9 +34,10 @@ console.log('Getting api');
2734connection . getGitApi ( ) . then ( gitApi => {
2835 console . log ( 'Creating PR' ) ;
2936 gitApi . createPullRequest ( pullRequestToCreate , azureDevOpsRepoId , project ) . then ( res => {
30- console . log ( `Created PR ${ res . url } ` ) ;
31- const prLink = res . url || 'https://dev.azure.com/mseng/AzureDevOps/_git/AzureDevOps/pullrequests?_a=active&createdBy=fe107a2d-fcce-6506-8e35-5554dbe120fd' ;
32- console . log ( `##vso[task.setvariable variable=PrLink]${ prLink } ` ) ;
37+ const prLink = getPullRequestLink ( res . repository . webUrl , res . pullRequestId ) ;
38+ console . log ( `Created PR ${ prLink } ` ) ;
39+ const prLinkRes = prLink || 'https://dev.azure.com/mseng/AzureDevOps/_git/AzureDevOps/pullrequests?_a=active&createdBy=fe107a2d-fcce-6506-8e35-5554dbe120fd' ;
40+ console . log ( `##vso[task.setvariable variable=PrLink]${ prLinkRes } ` ) ;
3341 } ) . catch ( err => {
3442 console . log ( err ) ;
3543 throw err ;
You can’t perform that action at this time.
0 commit comments