Created
February 12, 2015 23:52
-
-
Save sbedford/860429cb21bdb1db586e to your computer and use it in GitHub Desktop.
Git Jira Release Note Snippets
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 previousVersionTag = repo.Tags[options.PreviousVersion]; | |
var currentVersionTag = repo.Tags[options.CurrentVersion]; | |
var filter = new CommitFilter() | |
{ | |
Since = currentVersionTag, | |
Until = previousVersionTag | |
}; | |
var commits = repo.Commits.QueryBy(filter).ToList(); |
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
genReleaseNotes.sh v1.0.0.0 v1.0.1.0 |
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
public class IssueFieldsWithcomponent : IssueFields | |
{ | |
public IEnumerable<Component> components { get; set; } | |
public string customfield_10400 { get; set; } | |
public Issue<IssueFieldsWithcomponent> RelatedEpic = null; | |
public IssueFieldsWithcomponent() | |
: base() | |
{ | |
this.components = new List<Component>(); | |
} | |
} |
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
public class JiraIssueModel | |
{ | |
public string Reference { get; set; } | |
public string Title { get; set; } | |
public string Description { get; set; } | |
public string Components { get; set; } | |
public string Epic { get; set; } | |
public JiraIssueModel(Issue<IssueFieldsWithcomponent> jira) | |
{ | |
this.Reference = jira.key; | |
this.Title = jira.fields.summary; | |
this.Description = jira.fields.description; | |
StringBuilder c = new StringBuilder(); | |
jira.fields.components.ForEach(comp => c.AppendFormat("{0},", comp.name)); | |
this.Components = c.ToString(); | |
if (this.Components.Length > 0) | |
this.Components = this.Components.Substring(0, this.Components.Length - 1); | |
if (jira.fields.RelatedEpic != null) | |
this.Epic = string.Format("{0} - {1}", jira.fields.RelatedEpic.key, jira.fields.RelatedEpic.fields.summary); | |
} | |
} |
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 referencedJiras = from commit in commits | |
where regex.IsMatch(commit.Message) | |
select regex.Match(commit.Message); | |
var jiraClient = new TechTalk.JiraRestClient.JiraClient<IssueFieldsWithcomponent>(options.JiraServer, options.JiraUserName, options.JiraPassword); | |
foreach (var jira in referencedJiras) { | |
var issue = jiraClient.LoadIssue(referencedJira.Value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment