-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
91 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
GitHubReleaseNotes.exe --output ReleaseNotes.md --version 1.0.6 --skip-empty-releases | ||
GitHubReleaseNotes.exe --output ReleaseNotes.md --version 1.0.7 --skip-empty-releases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Id: StefHeyenrath.GitHubReleaseNotes | ||
Version: 1.0.7 | ||
Name: GitHubReleaseNotes | ||
AppMoniker: GitHubReleaseNotes | ||
Publisher: Stef Heyenrath | ||
License: MIT | ||
LicenseUrl: https://github.com/StefH/GitHubReleaseNotes/blob/master/LICENSE | ||
Homepage: https://github.com/StefH/GitHubReleaseNotes | ||
Description: Generate Release Notes in MarkDown format from a GitHub project. | ||
Tags: "github, markdown, releasenotes, changelog, tags, generate, md" | ||
InstallerType: Msi | ||
Installers: | ||
- Arch: x64 | ||
Url: https://github.com/StefH/GitHubReleaseNotes/releases/download/1.0.7/Setup.msi | ||
Sha256: 9F88FA4BC999380A1C0A5A955AC06CC00A2BDDF75AA5FEA0AA2DE593F1348C60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ public class RepositoryHelper | |
{ | ||
private const int DeltaSeconds = 30; | ||
|
||
private static readonly Regex OwnerAndProjectRegex = new Regex("(^https:\\/\\/github\\.com\\/(?<ownerHttps>.+)\\/(?<projectHttps>.+)\\.git)|(^git@github\\.com:(?<ownerSSH>.+)\\/(?<projectSSH>.+)\\.git$)$", RegexOptions.Compiled); | ||
|
||
private readonly IConfiguration _configuration; | ||
|
||
public RepositoryHelper(IConfiguration configuration) | ||
|
@@ -172,20 +174,14 @@ private async Task<ICollection<PullRequest>> GetMergedPullRequestsForRepositoryA | |
|
||
private static void GetOwnerAndProject(string url, out string owner, out string project) | ||
{ | ||
string pattern = @"^https:\/\/github.com\/(?<owner>.+)\/(?<project>.+).git$"; | ||
var groups = OwnerAndProjectRegex.Match(url).Groups; | ||
|
||
if (url.StartsWith("[email protected]:")) | ||
if (!TryGetValue(groups, "ownerHttps", "ownerSSH", out owner) || !TryGetValue(groups, "projectHttps", "projectSSH", out project)) | ||
{ | ||
pattern = @"^[email protected]:(?<owner>.+)\/(?<project>.+).git$"; | ||
throw new UriFormatException($"The url '{url}' is not a valid GitHub url, the Owner and or Project are not present."); | ||
} | ||
|
||
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()); | ||
|
@@ -196,5 +192,22 @@ private static void GetOwnerAndProject(string url, out string owner, out string | |
|
||
return null; | ||
} | ||
|
||
private static bool TryGetValue(GroupCollection groups, string groupName1, string groupName2, out string value) | ||
{ | ||
value = groups[groupName1].Value; | ||
if (!string.IsNullOrEmpty(value)) | ||
{ | ||
return true; | ||
} | ||
|
||
value = groups[groupName2].Value; | ||
if (!string.IsNullOrEmpty(value)) | ||
{ | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters