Skip to content

Commit 9358299

Browse files
committed
(GH-90) Relax restriction of one label per issue
Previously GitReleaseManager wasn't able to generate release note for issues with multiple labels. With this change it's become possible, but additional configuration flag needs to be set.
1 parent 50ab605 commit 9358299

13 files changed

+185
-2
lines changed

Source/GitReleaseManager.Tests/ConfigurationTests.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,31 @@ public void Should_Read_Label_Aliases()
3131
Assert.AreEqual("Baz", config.LabelAliases[1].Header);
3232
Assert.AreEqual("Qux", config.LabelAliases[1].Plural);
3333
}
34+
35+
[Test]
36+
public void Many_Labels_For_Issue_Disabled_By_Default()
37+
{
38+
// Given
39+
var text = Resources.Default_Configuration_Yaml;
40+
41+
// When
42+
var config = ConfigSerializer.Read(new StringReader(text));
43+
44+
// Then
45+
Assert.AreEqual(false, config.IssueLabelsMany);
46+
}
47+
48+
[Test]
49+
public void Should_Read_Many_Labels_Issue()
50+
{
51+
// Given
52+
var text = Resources.Many_Labels_For_Issue_Configuration_Yaml;
53+
54+
// When
55+
var config = ConfigSerializer.Read(new StringReader(text));
56+
57+
// Then
58+
Assert.AreEqual(true, config.IssueLabelsMany);
59+
}
3460
}
3561
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
As part of this release we had [1 issue](https://github.com/FakeRepository/issues/issues?milestone=0&state=closed) closed.
2+
3+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
As part of this release we had [5 commits](https://github.com/TestUser/FakeRepository/commits/1.2.3) which resulted in [1 issue](https://github.com/FakeRepository/issues/issues?milestone=0&state=closed) being closed.
2+
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
As part of this release we had [5 commits](https://github.com/TestUser/FakeRepository/commits/1.2.3) which resulted in [2 issues](https://github.com/FakeRepository/issues/issues?milestone=0&state=closed) being closed.
2+
3+
4+
__Help Wanteds__
5+
6+
- [__#1__](http://example.com/1) Issue 1
7+
- [__#2__](http://example.com/2) Issue 2
8+
9+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
As part of this release we had [5 commits](https://github.com/TestUser/FakeRepository/commits/1.2.3) which resulted in [2 issues](https://github.com/FakeRepository/issues/issues?milestone=0&state=closed) being closed.
2+
3+
4+
__Bug__
5+
6+
- [__#1__](http://example.com/1) Issue 1
7+
8+
__Help Wanteds__
9+
10+
- [__#1__](http://example.com/1) Issue 1
11+
- [__#2__](http://example.com/2) Issue 2
12+

Source/GitReleaseManager.Tests/ReleaseNotesBuilderTests.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,19 @@ public void NoCommitsWrongIssueLabel()
110110
Assert.Throws<AggregateException>(() => AcceptTest(0, CreateIssue(1, "Test")));
111111
}
112112

113+
[Test]
114+
public void SomeIssuesWithMultipleLabelsWhenManyLabelsDisabled()
115+
{
116+
Assert.Throws<AggregateException>(() => AcceptTest(5, CreateIssue(1, "Help Wanted", "Bug"), CreateIssue(2, "Help Wanted")));
117+
}
118+
119+
[Test]
120+
public void SomeIssuesWithMultipleLabelsWhenManyLabelsEnabled()
121+
{
122+
var config = new Config {IssueLabelsMany = true};
123+
AcceptTest(5, config, CreateIssue(1, "Help Wanted", "Bug", "Internal Refactoring"), CreateIssue(2, "Help Wanted"));
124+
}
125+
113126
[Test]
114127
public void SomeCommitsWrongIssueLabel()
115128
{

Source/GitReleaseManager.Tests/Resources.Designer.cs

Lines changed: 37 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/GitReleaseManager.Tests/Resources.resx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,38 @@ issue-labels-alias:
149149
header: Baz
150150
plural: Qux</value>
151151
</data>
152+
<data name="Many_Labels_For_Issue_Configuration_Yaml" xml:space="preserve">
153+
<value>create:
154+
include-footer: false
155+
footer-heading:
156+
footer-content:
157+
footer-includes-milestone: false
158+
milestone-replace-text:
159+
160+
export:
161+
include-created-date-in-title: false
162+
created-date-string-format:
163+
perform-regex-removal: false
164+
regex-text:
165+
multiline-regex: false
166+
167+
issue-labels-include:
168+
- Bug
169+
- Feature
170+
- Improvement
171+
172+
issue-labels-exclude:
173+
- Internal Refactoring
174+
175+
issue-labels-alias:
176+
- name: Bug
177+
header: Foo
178+
plural: Bar
179+
180+
- name: Improvement
181+
header: Baz
182+
plural: Qux
183+
184+
issue-labels-many: true</value>
185+
</data>
152186
</root>

0 commit comments

Comments
 (0)