Skip to content

Commit

Permalink
Fix issue where ssh remote urls don't work (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpann authored Feb 20, 2021
1 parent 7873e25 commit f95328a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/GitHubReleaseNotes.Logic/RepositoryHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,20 @@ private async Task<ICollection<PullRequest>> GetMergedPullRequestsForRepositoryA

private static void GetOwnerAndProject(string url, out string owner, out string project)
{
var regex = new Regex(@"^https:\/\/github.com\/(?<owner>.+)\/(?<project>.+).git$", RegexOptions.Compiled);
string pattern = @"^https:\/\/github.com\/(?<owner>.+)\/(?<project>.+).git$";

if (url.StartsWith("[email protected]:"))
{
pattern = @"^[email protected]:(?<owner>.+)\/(?<project>.+).git$";
}

var regex = new Regex(pattern, RegexOptions.Compiled);

owner = regex.Match(url).Groups["owner"].Value;
project = regex.Match(url).Groups["project"].Value;
}


private static long? GetVersionAsLong(string friendlyName)
{
var versionAsString = new string(friendlyName.Where(c => char.IsDigit(c) || c == '.').ToArray());
Expand Down

0 comments on commit f95328a

Please sign in to comment.