Skip to content

Commit

Permalink
fix: support legacy and new ado domain name (#86)
Browse files Browse the repository at this point in the history
* Update RepoGenerator.ts

Updated line to fetch orgName which causes issue while  creating repourl

* Update RepoGenerator.ts

Added support for legacy (https://{organization}.visualstudio.com) and new azure devops url (https://dev.azure.com/{organization})

* Update src/generators/azuredevops/generator/RepoGenerator.ts

Co-authored-by: Tom Ashworth <[email protected]>

* Update RepoGenerator.ts

Fixed lint package formatting issue

Co-authored-by: Tom Ashworth <[email protected]>
  • Loading branch information
Krutarth12 and tdashworth authored Sep 12, 2022
1 parent 29ed79a commit b3a89b8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/generators/azuredevops/generator/RepoGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ export default class RepoGenerator implements IGenerator<GitRepository> {
throw new Error('An error occurred while creating repository.');
}

const orgName = repo.remoteUrl!.split('/')[2].split('.')[0];
const orgName : string = repo.remoteUrl!.startsWith('https://dev.azure.com/')
? repo.remoteUrl!.split('/')[3] // for https://dev.azure.com/{orgname}/
: repo.remoteUrl!.split('/')[2].split('.')[0]; // for https://{orgname}.visualstudio.com/
const repoUrl = `https://${orgName}:${adoToken}@dev.azure.com/${orgName}/${encodeURIComponent(projectName)}/_git/${repoName}`;

await this.pushRepo(repoLocation, repoUrl);

return repo;
Expand Down

0 comments on commit b3a89b8

Please sign in to comment.