Skip to content

Commit 4a5aa0e

Browse files
committed
Add support for http urls
1 parent 5ed1cc1 commit 4a5aa0e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

create-pull-request.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ const error = chalk.keyword("red");
88

99
(async () => {
1010
try {
11-
const remoteOriginUrl = await gitRemoteOriginUrl();
11+
let remoteOriginUrl = await gitRemoteOriginUrl();
1212

13-
const repoUrl = remoteOriginUrl
14-
.replace(":", "/")
15-
.replace(/^git@/, "https://")
16-
.replace(/\.git$/, "");
13+
if (remoteOriginUrl.startsWith("git@")) {
14+
remoteOriginUrl = remoteOriginUrl
15+
.replace(/^git@/, "https://")
16+
.replace(/(com|org):/, "$1/");
17+
}
1718

18-
const pullRequestURL = getPullRequestUrl(repoUrl);
19+
remoteOriginUrl = remoteOriginUrl.replace(/\.git$/, "");
20+
const pullRequestURL = getPullRequestUrl(remoteOriginUrl);
1921
if (!pullRequestURL) {
2022
return;
2123
}

0 commit comments

Comments
 (0)