diff --git a/src/lib/converter/plugins/GitHubPlugin.ts b/src/lib/converter/plugins/GitHubPlugin.ts index ba598a5daf..ffa79b55b9 100644 --- a/src/lib/converter/plugins/GitHubPlugin.ts +++ b/src/lib/converter/plugins/GitHubPlugin.ts @@ -72,6 +72,11 @@ export class Repository { repoLinks[i] ); + // Github Enterprise + if (!match) { + match = /(\w+\.githubprivate.com)[:/]([^/]+)\/(.*)/.exec(repoLinks[i]); + } + if (!match) { match = /(bitbucket.org)[:/]([^/]+)\/(.*)/.exec(repoLinks[i]); } diff --git a/src/test/GitHubPlugin.test.ts b/src/test/GitHubPlugin.test.ts index 22778419a0..78e069126d 100644 --- a/src/test/GitHubPlugin.test.ts +++ b/src/test/GitHubPlugin.test.ts @@ -33,6 +33,17 @@ describe("Repository", function () { equal(repository.type, RepositoryType.GitHub); }); + it("handles a githubprivate.com URL", function () { + const mockRemotes = ["ssh://org@bigcompany.githubprivate.com/joebloggs/foobar.git"]; + + const repository = new github.Repository("", "", mockRemotes); + + equal(repository.hostname, "bigcompany.githubprivate.com"); + 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",