mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-11 17:50:58 +00:00
fix #26 - improve regex for matching github repo. add unit test to cover
This commit is contained in:
parent
36c11232c1
commit
622d0e27c7
2 changed files with 2 additions and 1 deletions
|
@ -137,7 +137,7 @@ func findGitSlug(url string) (string, string, error) {
|
|||
codeCommitHTTPRegex := regexp.MustCompile(`^http(s?)://git-codecommit\.(.+)\.amazonaws.com/v1/repos/(.+)$`)
|
||||
codeCommitSSHRegex := regexp.MustCompile(`ssh://git-codecommit\.(.+)\.amazonaws.com/v1/repos/(.+)$`)
|
||||
httpRegex := regexp.MustCompile("^http(s?)://.*github.com.*/(.+)/(.+).git$")
|
||||
sshRegex := regexp.MustCompile("github.com:(.+)/(.+).git$")
|
||||
sshRegex := regexp.MustCompile("github.com[:/](.+)/(.+).git$")
|
||||
|
||||
if matches := codeCommitHTTPRegex.FindStringSubmatch(url); matches != nil {
|
||||
return "CodeCommit", matches[3], nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue