Skip to content

Instantly share code, notes, and snippets.

@adamralph
Last active August 29, 2015 14:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamralph/0b5d1cd8efd7d5c400cf to your computer and use it in GitHub Desktop.
Save adamralph/0b5d1cd8efd7d5c400cf to your computer and use it in GitHub Desktop.
Create release notes from GitHub issues with power of scriptcs and Octokit!
var owner = "scriptcs";
var repo = "scriptcs";
var milestone = "v0.10";
var labels = new Dictionary<string, string>{ { "feature", "New" }, { "bug", "Fixed" } };
var username = "adamralph";
var oAuthToken = "secret";
var client = Require<OctokitPack>().CreateWithOAuth("ScriptCs.ReleaseNotesScript", username, oAuthToken);
var issues = client.Issue.GetForRepository(owner, repo, new RepositoryIssueRequest { State = ItemState.Closed, }).Result;
foreach (var issue in issues
.Where(issue => issue.Milestone != null && issue.Milestone.Title == milestone && issue.Labels.Any(label => labels.Keys.Contains(label.Name)))
.Select(issue => new { Number = issue.Number, Title = issue.Title, Label = issue.Labels.First(label => labels.Keys.Contains(label.Name)) })
.OrderBy(issue => issue.Label.Name))
{
Console.WriteLine("**{0}:** {1} - #{2}", labels[issue.Label.Name], issue.Title, issue.Number);
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Octokit" version="0.1.8" targetFramework="net45" />
<package id="ScriptCs.Contracts" version="0.8.1" targetFramework="net45" />
<package id="ScriptCs.Octokit" version="0.2.1" targetFramework="net45" />
</packages>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment