diff --git a/lib/generateReleaseNotes.js b/lib/generateReleaseNotes.js index 4b6f4a5..dc09fd5 100644 --- a/lib/generateReleaseNotes.js +++ b/lib/generateReleaseNotes.js @@ -2,6 +2,7 @@ const debug = require('debug')('generate-release-notes'); const Handlebars = require('handlebars'); const fs = require('mz/fs'); const path = require('path'); +const { filter } = require('rsvp'); const getTagInfo = async (octokit, owner, repo, tag) => { debug(`Getting info for the ${tag} tag in ${owner}/${repo}`); @@ -67,8 +68,21 @@ 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('duplicate') && + + const skippedIssues = await filter(minimalIssues, async ({pull_request, number, labels}) => { + let isMergedOrNotAPullRequest = true; + if (pull_request) { + try { + await octokit.pulls.checkIfMerged({ owner, repo, number }); + } catch (e) { + if (e.status === 404) { + isMergedOrNotAPullRequest = false; + } + } + } + + return isMergedOrNotAPullRequest && + !labels.includes('duplicate') && !labels.includes('wontfix/works for me') ; }); diff --git a/package.json b/package.json index 7c3bf58..96c860e 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "debug": "^4.1.1", "handlebars": "^4.0.11", "meow": "^5.0.0", - "mz": "^2.7.0" + "mz": "^2.7.0", + "rsvp": "^4.8.4" }, "devDependencies": { "eslint": "^5.13.0", diff --git a/yarn.lock b/yarn.lock index d1af9ec..6105f41 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1109,6 +1109,11 @@ rimraf@~2.6.2: dependencies: glob "^7.1.3" +rsvp@^4.8.4: + version "4.8.4" + resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.4.tgz#b50e6b34583f3dd89329a2f23a8a2be072845911" + integrity sha512-6FomvYPfs+Jy9TfXmBpBuMWNH94SgCsZmJKcanySzgNNP6LjWxBvyLTa9KaMfDDM5oxRfrKDB0r/qeRsLwnBfA== + run-async@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0"