diff --git a/src/lib/converter/plugins/GitHubPlugin.ts b/src/lib/converter/plugins/GitHubPlugin.ts index ec69e4da7..3b3f35c71 100644 --- a/src/lib/converter/plugins/GitHubPlugin.ts +++ b/src/lib/converter/plugins/GitHubPlugin.ts @@ -78,6 +78,13 @@ 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 22778419a..6616f1ef5 100644 --- a/src/test/GitHubPlugin.test.ts +++ b/src/test/GitHubPlugin.test.ts @@ -33,6 +33,19 @@ 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",