# <%= config.appName %> <%= changeInfo.header %> Release Notes - <%= latestReference?.date?.split("T")[0] %>

## Summary:
<% sections.summary.commits.forEach(function(commit) { %>
- <%= commit.title %>: <%= commit.count %> <%= commit.count === 1 ? 'commit' : 'commits' %>
<% }) %>
<% sections.summary.notes.forEach(function(note) { %>
- <%= note.title %>: <%= note.count %> <%= note.count === 1 ? 'note' : 'notes' %>
<% }) %>
and <%= sections.summary.contributors.length %> <%= sections.summary.contributors.length === 1 ? '❤️ contributor' : '❤️ contributors' %>


<% if (sections.notes.length > 0) { %>
## Notes
<% sections.notes.forEach((note) => { %>
### <%= note.title %>
<% note.items.forEach(item => { %>
<% 
  const commitLinks = `[#${item.commit.raw.shortHash}](#commit-${item.commit.raw.shortHash})`;
%>
- <%= item.note.content %> (<%= commitLinks %>)
<% }) %>
<% }) %>
<% } %>


<% if (sections.commits.length > 0) { %>
## Changes
<% sections.commits.forEach((section) => { %>
### <%= section.title %>:
<%
  section.items.forEach(commit => {
    const author = `[@${commit.author.name}](${commit.author.profileUrl})`;
    const mentions = commit.mentions
      ? commit.mentions
          .filter(mention => ['co-authored-by', 'helped-by'].includes(mention.type))
          .map(mention => `[@${mention.name}](${mention.profileUrl})`)
          .join(', ')
      : '';
    const authorText = mentions ? `${author} with ${mentions}` : author;
    
    const commitLink = `[#${commit.raw.shortHash}](${repository.remote.repoUrl}/commit/${commit.raw.hash})`;
    
    const issueLinks = commit.links && commit.links.length > 0
      ? ` (${commit.links.length === 1 ? 'Issue' : 'Issues'}: ${commit.links.map(link => `[#${link.id}](${repository.remote.repoUrl}/issues/${link.id})`).join(', ')})`
      : '';

    const scopeText = commit.scope ? `**${commit.scope}** ` : '';
%>
- <a id="commit-<%= commit.raw.shortHash %>"></a><%= scopeText %><%= commitLink %>: <%= commit.summary %> (by <%= authorText %>) <%= issueLinks %>
<% if (commit.description) { %>

<%= commit.description?.split('\n').map(line => `\t${line.trim()}`).join('\n') %>
<% } %>
<% }); %>
<% }) %>
<% } %>

## Useful Links
- 📜 [Full Changelog](<%= repository.remote.repoUrl %>/blob/main/CHANGELOG.md)


<% if (sections.contributors.length > 0) { %>
## Contributors:
<% sections.contributors.forEach((contributor) => { %>
- [<%= contributor.name %>](<%= contributor.profileUrl %>) <% if (contributor.groups.length > 0) { %>(<%= contributor.groups.map(group => group.title).join(', ') %>)<% } %>
<% }) %>
<% } %>