Skip to content

Commit

Permalink
Support githubprivate.com in GitHubPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
nlfurniss committed Oct 22, 2021
1 parent c35f10a commit a0a127f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lib/converter/plugins/GitHubPlugin.ts
Expand Up @@ -72,6 +72,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]);
}
Expand Down
13 changes: 13 additions & 0 deletions src/test/GitHubPlugin.test.ts
Expand Up @@ -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",
Expand Down

0 comments on commit a0a127f

Please sign in to comment.