diff --git a/pkg/commands/pull_request.go b/pkg/commands/pull_request.go index 186ed09b3..ed065bbec 100644 --- a/pkg/commands/pull_request.go +++ b/pkg/commands/pull_request.go @@ -12,8 +12,8 @@ import ( // if you want to make a custom regex for a given service feel free to test it out // at regoio.herokuapp.com var defaultUrlRegexStrings = []string{ - `^https?://.*/(?P.*)/(?P.*?)(\.git)?$`, - `^git@.*:(?P.*)/(?P.*?)(\.git)?$`, + `^(?:https?|ssh)://.*/(?P.*)/(?P.*?)(?:\.git)?$`, + `^git@.*:(?P.*)/(?P.*?)(?:\.git)?$`, } // Service is a service that repository is on (Github, Bitbucket, ...) diff --git a/pkg/commands/pull_request_test.go b/pkg/commands/pull_request_test.go index b6ec527de..6195dff4c 100644 --- a/pkg/commands/pull_request_test.go +++ b/pkg/commands/pull_request_test.go @@ -34,6 +34,15 @@ func TestGetRepoInfoFromURL(t *testing.T) { assert.EqualValues(t, repoInfo.Repository, "super_calculator") }, }, + { + NewGithubService("github.com", "github.com"), + "Returns repository information for ssh remote url", + "ssh://git@github.com/petersmith/super_calculator", + func(repoInfo *RepoInformation) { + assert.EqualValues(t, repoInfo.Owner, "petersmith") + assert.EqualValues(t, repoInfo.Repository, "super_calculator") + }, + }, { NewGithubService("github.com", "github.com"), "Returns repository information for http remote url",