From aaf3c3265f4d7f3ffbf7909de176cd7a7e5b427c Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Wed, 6 Feb 2019 20:04:00 -0800 Subject: [PATCH] Pull out dependencies into their own section Collapse it by default because it's not really that interesting --- lib/generateReleaseNotes.js | 18 +++++++++--------- templates/release-notes.hbs | 16 +++++++++++----- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/generateReleaseNotes.js b/lib/generateReleaseNotes.js index 4a48c99..039fe55 100644 --- a/lib/generateReleaseNotes.js +++ b/lib/generateReleaseNotes.js @@ -70,27 +70,27 @@ const getClosedIssues = async (octokit, owner, repo, since) => { return {title, number, url: html_url, pull_request, user: minimalUser, labels: labelTitles}; }); const skippedIssues = minimalIssues.filter(({labels}) => { - return !labels.includes('greenkeeper') && - !labels.includes('duplicate') && + return !labels.includes('duplicate') && !labels.includes('wontfix/works for me') ; }); - const pullRequests = skippedIssues.filter(({pull_request}) => pull_request); - const bugs = skippedIssues.filter(obj => obj.labels.includes('bug') && !pullRequests.includes(obj)); - const enhancements = skippedIssues.filter(obj => obj.labels.includes('enhancement') && !bugs.includes(obj) && !pullRequests.includes(obj)); - const remaining = skippedIssues.filter(obj => !pullRequests.includes(obj) && !bugs.includes(obj) && !enhancements.includes(obj)); + const dependencies = skippedIssues.filter(obj => obj.labels.includes('dependencies')); + const pullRequests = skippedIssues.filter(obj => obj.pull_request && !dependencies.includes(obj)); + const bugs = skippedIssues.filter(obj => obj.labels.includes('bug') && !pullRequests.includes(obj) && !dependencies.includes(obj)); + const enhancements = skippedIssues.filter(obj => obj.labels.includes('enhancement') && !bugs.includes(obj) && !pullRequests.includes(obj) && !dependencies.includes(obj)); + const remaining = skippedIssues.filter(obj => !dependencies.includes(obj) && !pullRequests.includes(obj) && !bugs.includes(obj) && !enhancements.includes(obj)); - return {pullRequests, bugs, enhancements, remaining}; + return { dependencies, pullRequests, bugs, enhancements, remaining }; }; const generateReleaseNotes = async (octokit, owner, repo, sinceTagName, releaseTagName) => { debug(`Creating ${releaseTagName} release notes for ${owner}/${repo} at ${releaseTagName}`); const sinceTag = await getTagInfo(octokit, owner, repo, sinceTagName); - const {pullRequests, bugs, enhancements, remaining} = await getClosedIssues(octokit, owner, repo, sinceTag.date); + const {dependencies, pullRequests, bugs, enhancements, remaining} = await getClosedIssues(octokit, owner, repo, sinceTag.date); const template = await fs.readFile(path.join(__dirname, '../templates/release-notes.hbs')); const hbs = Handlebars.compile(template.toString()); const repositoryUrl = `https://github.com/${owner}/${repo}`; - const markdown = hbs({pullRequests, bugs, enhancements, remaining, releaseTagName, sinceTagName, repositoryUrl}); + const markdown = hbs({dependencies, pullRequests, bugs, enhancements, remaining, releaseTagName, sinceTagName, repositoryUrl}); return markdown; }; diff --git a/templates/release-notes.hbs b/templates/release-notes.hbs index 7b0b3b1..b6f0511 100644 --- a/templates/release-notes.hbs +++ b/templates/release-notes.hbs @@ -1,5 +1,3 @@ -# {{releaseTagName}} - ## [{{releaseTagName}}]({{repositoryUrl}}/tree/{{releaseTagName}}) [Full Changelog]({{repositoryUrl}}/compare/{{sinceTagName}}...{{releaseTagName}}) @@ -12,21 +10,29 @@ - {{issue.title}} [\#{{issue.number}}]({{issue.url}}) {{/each}} {{/if}} + {{/inline}} {{> issueBlock title='Fixed Bugs' issues=bugs}} - {{> issueBlock title='Added Enhancements' issues=enhancements}} - {{> issueBlock title='Closed issues' issues=remaining}} - {{#if pullRequests.length}} **Merged pull requests:** {{#each pullRequests as |issue|}} - {{issue.title}} [\#{{issue.number}}]({{issue.url}}) [@{{issue.user.login}}]({{issue.user.url}}) {{/each}} + {{/if}} +{{#if dependencies.length}} +
+Updated Dependencies: +{{#each dependencies as |issue|}} +- {{issue.title}} [\#{{issue.number}}]({{issue.url}}) +{{/each}} +
+ +{{/if}} \* *These notes were automatically created by [generate-github-release-notes](https://github.com/jrjohnson/generate-github-release-notes)*