Created
March 6, 2015 07:57
-
-
Save gep13/5744368e4097e73f8031 to your computer and use it in GitHub Desktop.
Create ChocolateyGUI release notes using OctoKit
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
var github = new GitHubClient(new ProductHeaderValue("ChocolateyGUI")); | |
var lst = github.Release.GetAll("chocolatey", "chocolateygui").Result.OrderByDescending(r => r.CreatedAt); | |
string path = @"c:\temp\CHANGELOG.md"; | |
if (File.Exists(path)) | |
{ | |
File.Delete(path); | |
} | |
using (var sw = new StreamWriter(File.Open(path, FileMode.OpenOrCreate))) | |
{ | |
foreach(var release in lst) | |
{ | |
sw.WriteLine(string.Format("## {0} ({1})", release.TagName, release.CreatedAt.ToString("MMMM dd, yyyy"))); | |
sw.WriteLine(Environment.NewLine); | |
var regexPattern = new Regex(@"### Where to get it(\r\n)*You can .*\)", RegexOptions.Multiline); | |
var replacement = string.Empty; | |
var replacedBody = regexPattern.Replace(release.Body, replacement); | |
sw.WriteLine(replacedBody); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment