Skip to content
This repository was archived by the owner on Sep 20, 2022. It is now read-only.

Commit c6acc9e

Browse files
author
Jake Ginnivan
committed
Format issue number at start of release note item. Fixes #31
1 parent 4d1e452 commit c6acc9e

9 files changed

+14
-13
lines changed

src/GitReleaseNotes.Tests/IssueTrackers/GitHub/GitHubIssueTrackerTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public void CreatesReleaseNotesForClosedGitHubIssues()
6565
var closedIssues = _sut.GetClosedIssues(DateTimeOffset.Now.AddDays(-2));
6666
var onlineIssue = closedIssues.Single();
6767
onlineIssue.Title.ShouldBe("Issue Title");
68+
onlineIssue.Id.ShouldBe("#1");
6869
onlineIssue.Contributors.ShouldContain(c => c.Username == "User" && c.Name == "Foo" && c.Url == "http://github.com/foo");
6970
}
7071

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
 - Issue 1 [#1](http://github.com/org/repo/issues/1) +internal-refactoring
1+
 - [#1](http://github.com/org/repo/issues/1) - Issue 1 +internal-refactoring
22

33
Commits: 12345678...67890123
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
 - Issue 1 [#1](http://github.com/org/repo/issues/1) contributed by Foo Bar ([@foo](http://url.com/foo))
1+
 - [#1](http://github.com/org/repo/issues/1) - Issue 1 contributed by Foo Bar ([@foo](http://url.com/foo))
22
- Issue 1
33

44
Commits: 12345678...67890123
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
 - Customised title for Issue 1 [#1](http://github.com/org/repo/issues/1)
2-
- Issue 2 [#2](http://github.com/org/repo/issues/2)
1+
 - [#1](http://github.com/org/repo/issues/1) - Customised title for Issue 1
2+
- [#2](http://github.com/org/repo/issues/2) - Issue 2
33

44
Commits: 12345678...67890123
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
 - Issue 1 [#1](http://github.com/org/repo/issues/1) +feature
1+
 - [#1](http://github.com/org/repo/issues/1) - Issue 1 +feature
22

33
Commits: 12345678...67890123
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
 - Issue 1 [#1](http://github.com/org/repo/issues/1) +fix
1+
 - [#1](http://github.com/org/repo/issues/1) - Issue 1 +fix
22

33
Commits: 12345678...67890123
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# vNext
22

3-
- Issue 1 [#1](http://github.com/org/repo/issues/1) +feature
3+
- [#1](http://github.com/org/repo/issues/1) - Issue 1 +feature
44

55
Commits: 12345678...67890123
66

77

88
# 1.2.0 (06 December 2013)
99

10-
- Issue 2 [#2](http://github.com/org/repo/issues/2) +feature
11-
- Issue 3 [#3](http://github.com/org/repo/issues/3) +fix
10+
- [#2](http://github.com/org/repo/issues/2) - Issue 2 +feature
11+
- [#3](http://github.com/org/repo/issues/3) - Issue 3 +fix
1212

1313
Commits: asdsadaf...bfdsadre

src/GitReleaseNotes/IssueTrackers/GitHub/GitHubIssueTracker.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ public IEnumerable<OnlineIssue> GetClosedIssues(DateTimeOffset? since)
144144
};
145145
return readOnlyList.Select(i => new OnlineIssue
146146
{
147+
Id = "#" + i.Number.ToString(CultureInfo.InvariantCulture),
147148
HtmlUrl = i.HtmlUrl,
148-
Id = i.Number.ToString(CultureInfo.InvariantCulture),
149+
Title = i.Title,
149150
IssueType = i.PullRequest == null ? IssueType.Issue : IssueType.PullRequest,
150151
Labels = i.Labels.Select(l => l.Name).ToArray(),
151-
Title = i.Title,
152152
DateClosed = i.ClosedAt.Value,
153153
Contributors = i.PullRequest == null ? new Contributor[0] : new[] { new Contributor(getUserName(i.User), i.User.Login, i.User.HtmlUrl) }
154154
});

src/GitReleaseNotes/ReleaseNotesGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ public string GenerateReleaseNotes(
6767
var url = htmlUrl == null ? null : string.Format("({0})", htmlUrl);
6868
var contributors = releaseNoteItem.Contributors == null || releaseNoteItem.Contributors.Length == 0 ?
6969
string.Empty : " contributed by " + string.Join(", ", releaseNoteItem.Contributors.Select(r => string.Format("{0} ([{1}]({2}))", r.Name, r.Username, r.Url)));
70-
var item = string.Format("{4}{0}{1}{2}{5}{3}", title, issueNum, url, category,
70+
var item = string.Format(" - {1}{2}{4}{0}{5}{3}", title, issueNum, url, category,
7171
title.TrimStart().StartsWith("-") ? null : " - ",
72-
contributors);
72+
contributors).Replace(" ", " ").Replace("- -", "-");
7373
builder.AppendLine(item);
7474
}
7575

0 commit comments

Comments
 (0)