Skip to content

Commit 272bd03

Browse files
committed
Revert changes made to the default template and instead create a distinct template called "contributors".
1 parent 1c60283 commit 272bd03

File tree

17 files changed

+105
-52
lines changed

17 files changed

+105
-52
lines changed

src/GitReleaseManager.Core/Configuration/Config.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public Config()
2727
ShaSectionHeading = "SHA256 Hashes of the release artifacts",
2828
ShaSectionLineFormat = "- `{1}\t{0}`",
2929
AllowUpdateToPublishedRelease = false,
30+
IncludeContributors = true,
3031
};
3132

3233
Export = new ExportConfig

src/GitReleaseManager.Core/Configuration/CreateConfig.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,8 @@ public class CreateConfig
3434

3535
[YamlMember(Alias = "allow-update-to-published")]
3636
public bool AllowUpdateToPublishedRelease { get; set; }
37+
38+
[YamlMember(Alias = "include-contributors")]
39+
public bool IncludeContributors { get; set; }
3740
}
3841
}

src/GitReleaseManager.Core/ReleaseNotes/ReleaseNotesBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public async Task<string> BuildReleaseNotesAsync(string user, string repository,
7575
issue.LinkedIssues = linkedIssues?.ToList().AsReadOnly() ?? Array.AsReadOnly(Array.Empty<Issue>());
7676
}
7777

78-
var contributors = GetContributors(distinctValidIssues);
78+
var contributors = _configuration.Create.IncludeContributors ? GetContributors(distinctValidIssues) : Enumerable.Empty<User>();
7979

8080
var milestoneQueryString = _vcsProvider.GetMilestoneQueryString();
8181

@@ -88,7 +88,7 @@ public async Task<string> BuildReleaseNotesAsync(string user, string repository,
8888
},
8989
Contributors = new
9090
{
91-
Count = contributors.Count,
91+
Count = contributors.Count(),
9292
Items = contributors,
9393
},
9494
Commits = new
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{ if config.create.include_footer }}
2+
3+
### {{ config.create.footer_heading }}
4+
5+
{{ if config.create.milestone_replace_text
6+
replace_milestone_title config.create.footer_content config.create.milestone_replace_text milestone.target.title
7+
else
8+
config.create.footer_content
9+
end
10+
end }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{-
2+
include 'release-info'
3+
if milestone.target.description
4+
include 'milestone'
5+
end
6+
include 'issues' | string.rstrip
7+
if contributors.count > 0
8+
include 'contributors'
9+
end
10+
if template_kind == "CREATE"
11+
include 'create/footer'
12+
end
13+
~}}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
__{{ issue_label }}__
3+
{{ for issue in issues.items[issue_label]
4+
include 'issue-note'
5+
end }}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{{
2+
func IssueDescription
3+
if $0.is_pull_request
4+
$description = "[__!" + $0.public_number + "__]"
5+
else
6+
$description = "[__#" + $0.public_number + "__]"
7+
end
8+
$description = $description + "(" + $0.html_url + ")"
9+
if $1
10+
$description = $description + " " + $0.title
11+
end
12+
if $0.user
13+
$description = $description + " by [" + $0.user.login + "](" + $0.user.html_url + ")"
14+
end
15+
if $0.linked_issues
16+
$description = $description + LinkedIssuesDescription($0.linked_issues)
17+
end
18+
ret $description
19+
end
20+
func LinkedIssuesDescription
21+
$countPRs = 0
22+
$countIssues = 0
23+
for linkedIssue in $0
24+
if linkedIssue.is_pull_request
25+
if $countPRs == 0
26+
$resolvedBy = " resolved in "
27+
else
28+
$resolvedBy = $resolvedBy + ", "
29+
end
30+
$resolvedBy = $resolvedBy + IssueDescription(linkedIssue, false)
31+
$countPRs = $countPRs + 1
32+
else
33+
if $countIssues == 0
34+
$raisedIn = " raised in "
35+
else
36+
$raisedIn = $raisedIn + ", "
37+
end
38+
$raisedIn = $raisedIn + IssueDescription(linkedIssue, false)
39+
$countIssues = $countIssues + 1
40+
end
41+
end
42+
ret $raisedIn + $resolvedBy
43+
end
44+
}}
45+
- {{ IssueDescription(issue, true) }}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{ for issue_label in issue_labels
2+
include 'issue-details'
3+
end }}

0 commit comments

Comments
 (0)