Skip to content

Instantly share code, notes, and snippets.

@gep13
Created March 6, 2015 07:57
Show Gist options
  • Save gep13/5744368e4097e73f8031 to your computer and use it in GitHub Desktop.
Save gep13/5744368e4097e73f8031 to your computer and use it in GitHub Desktop.
Create ChocolateyGUI release notes using OctoKit
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