@semantic-release/github
Advanced tools
Comparing version 4.2.8 to 4.2.9
@@ -1,3 +0,4 @@ | ||
const {isUndefined, uniqBy, template} = require('lodash'); | ||
const {isUndefined, uniqBy, template, flatten} = require('lodash'); | ||
const parseGithubUrl = require('parse-github-url'); | ||
const pFilter = require('p-filter'); | ||
const AggregateError = require('aggregate-error'); | ||
@@ -20,12 +21,12 @@ const issueParser = require('issue-parser')('github'); | ||
const releaseInfos = releases.filter(release => Boolean(release.name)); | ||
const shas = commits.map(commit => commit.hash); | ||
const prs = [].concat( | ||
...(await Promise.all( | ||
getSearchQueries(`repo:${owner}/${repo}+type:pr`, commits.map(commit => commit.hash)).map(async q => { | ||
const {data: {items}} = await github.search.issues({q}); | ||
return items; | ||
}) | ||
)) | ||
const searchQueries = getSearchQueries(`repo:${owner}/${repo}+type:pr+is:merged`, shas).map( | ||
async q => (await github.search.issues({q})).data.items | ||
); | ||
const prs = await pFilter(uniqBy(flatten(await Promise.all(searchQueries)), 'number'), async ({number}) => | ||
(await github.pullRequests.getCommits({owner, repo, number})).data.find(({sha}) => shas.includes(sha)) | ||
); | ||
debug('found pull requests: %O', prs.map(pr => pr.number)); | ||
@@ -54,6 +55,12 @@ | ||
try { | ||
const comment = {owner, repo, number: issue.number, body}; | ||
debug('create comment: %O', comment); | ||
const {data: {html_url: url}} = await github.issues.createComment(comment); | ||
logger.log('Added comment to issue #%d: %s', issue.number, url); | ||
const {data: {state}} = await github.issues.get({owner, repo, number: issue.number}); | ||
if (state === 'closed') { | ||
const comment = {owner, repo, number: issue.number, body}; | ||
debug('create comment: %O', comment); | ||
const {data: {html_url: url}} = await github.issues.createComment(comment); | ||
logger.log('Added comment to issue #%d: %s', issue.number, url); | ||
} else { | ||
logger.log("Skip comment on issue #%d as it's open: %s", issue.number); | ||
} | ||
} catch (err) { | ||
@@ -60,0 +67,0 @@ if (err.code === 404) { |
{ | ||
"name": "@semantic-release/github", | ||
"description": "Set of semantic-release plugins for publishing a GitHub release", | ||
"version": "4.2.8", | ||
"version": "4.2.9", | ||
"author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)", | ||
@@ -29,2 +29,3 @@ "bugs": { | ||
"mime": "^2.0.3", | ||
"p-filter": "^1.0.0", | ||
"p-retry": "^1.0.0", | ||
@@ -31,0 +32,0 @@ "parse-github-url": "^1.0.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47646
631
14
+ Addedp-filter@^1.0.0
+ Addedp-filter@1.0.0(transitive)
+ Addedp-map@1.2.0(transitive)