Skip to content

Commit

Permalink
Add more Github Enterprise URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
chadhietala committed Jul 13, 2022
1 parent dd15e08 commit f1d4d08
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lib/converter/utils/repository.ts
Expand Up @@ -82,6 +82,20 @@ export class Repository {
);
}

// Github Enterprise
if (!match) {
match = /(\w+\.ghe.com)[:/]([^/]+)\/(.*)/.exec(
repoLinks[i]
);
}

// Github Enterprise
if (!match) {
match = /(\w+\.github.us)[:/]([^/]+)\/(.*)/.exec(
repoLinks[i]
);
}

if (!match) {
match = /(bitbucket.org)[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
}
Expand Down
26 changes: 26 additions & 0 deletions src/test/Repository.test.ts
Expand Up @@ -46,6 +46,32 @@ describe("Repository", function () {
equal(repository.type, RepositoryType.GitHub);
});

it("handles a ghe.com URL", function () {
const mockRemotes = [
"ssh://org@bigcompany.ghe.com/joebloggs/foobar.git",
];

const repository = new Repository("", "", mockRemotes);

equal(repository.hostname, "bigcompany.ghe.com");
equal(repository.user, "joebloggs");
equal(repository.project, "foobar");
equal(repository.type, RepositoryType.GitHub);
});

it("handles a github.us URL", function () {
const mockRemotes = [
"ssh://org@bigcompany.github.us/joebloggs/foobar.git",
];

const repository = new Repository("", "", mockRemotes);

equal(repository.hostname, "bigcompany.github.us");
equal(repository.user, "joebloggs");
equal(repository.project, "foobar");
equal(repository.type, RepositoryType.GitHub);
});

it("handles a Bitbucket HTTPS URL", function () {
const mockRemotes = [
"https://joebloggs@bitbucket.org/joebloggs/foobar.git",
Expand Down

0 comments on commit f1d4d08

Please sign in to comment.