diff --git a/lib/prepare_security.js b/lib/prepare_security.js index 8c303187..6e355bfa 100644 --- a/lib/prepare_security.js +++ b/lib/prepare_security.js @@ -55,6 +55,22 @@ export default class PrepareSecurityRelease extends SecurityRelease { // For now, close the ones with Security Release label await this.closePRWithLabel('Security Release'); + if (vulnerabilityJSON.buildIssue) { + this.cli.info('Commenting on nodejs/build issue'); + await this.req.commentIssue( + vulnerabilityJSON.buildIssue, + 'Security release is out' + ); + } + + if (vulnerabilityJSON.dockerIssue) { + this.cli.info('Commenting on nodejs/docker-node issue'); + await this.req.commentIssue( + vulnerabilityJSON.dockerIssue, + 'Security release is out' + ); + } + const updateFolder = await this.cli.prompt( `Would you like to update the next-security-release folder to ${ vulnerabilityJSON.releaseDate}?`, diff --git a/lib/request.js b/lib/request.js index b379c1f8..289f13fa 100644 --- a/lib/request.js +++ b/lib/request.js @@ -81,6 +81,23 @@ export default class Request { return this.json(url, options); } + async commentIssue(fullUrl, comment) { + const commentUrl = fullUrl.replace('https://github.com/', 'https://api.github.com/repos/') + + '/comments'; + const options = { + method: 'POST', + headers: { + Authorization: `Basic ${this.credentials.github}`, + 'User-Agent': 'node-core-utils', + Accept: 'application/vnd.github+json' + }, + body: JSON.stringify({ + body: comment, + }) + }; + return this.json(commentUrl, options); + } + async getPullRequest(fullUrl) { const prUrl = fullUrl.replace('https://github.com/', 'https://api.github.com/repos/').replace('pull', 'pulls'); const options = {