Skip to content

Commit d7dc4dd

Browse files
committed
fix: Be more lenient when validating repository urls
1 parent f435ec0 commit d7dc4dd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,11 @@ export function getCommitsSince(sinceCommit = null) {
139139
/** Gets the current repository. */
140140
export function getRepo() {
141141
const url = exec("git", ["config", "--get", "remote.origin.url"]);
142-
const match = /(\w+)\/(\w+)(?:\.git)?$/.exec(url);
142+
const match = /\/(\w(?:[-_.]?\w)*)\/(\w(?:[-_.]?\w)*)$/.exec(url);
143143
if (!match) throw Error("invalid repository url: " + url);
144-
return match[1] + "/" + match[2];
144+
const user = match[1];
145+
const repo = match[2].replace(/\.git$/, "");
146+
return `${user}/${repo}`;
145147
}
146148

147149
/** Gets the GitHub token to use. */

0 commit comments

Comments
 (0)