(repo: BitbucketRepository)
| 429 | } |
| 430 | |
| 431 | const getCloneUrl = (repo: BitbucketRepository) => { |
| 432 | if (!repo.links) { |
| 433 | throw new Error(`No clone links found for server repo ${repo.name}`); |
| 434 | } |
| 435 | |
| 436 | // In the cloud case we simply fetch the html link and use that as the clone url. For server we |
| 437 | // need to fetch the actual clone url |
| 438 | if (config.deploymentType === 'cloud') { |
| 439 | const htmlLink = repo.links.html as { href: string }; |
| 440 | return htmlLink.href; |
| 441 | } |
| 442 | |
| 443 | const cloneLinks = repo.links.clone as { |
| 444 | href: string; |
| 445 | name: string; |
| 446 | }[]; |
| 447 | |
| 448 | for (const link of cloneLinks) { |
| 449 | if (link.name === 'http') { |
| 450 | return link.href; |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | throw new Error(`No clone links found for repo ${repo.name}`); |
| 455 | } |
| 456 | |
| 457 | const getWebUrl = (repo: BitbucketRepository) => { |
| 458 | const isServer = config.deploymentType === 'server'; |
no outgoing calls
no test coverage detected