Skip to content

Commit 0f925ad

Browse files
authored
feat: comment on build and docker-node issue on cleanup (nodejs#973)
Refs: nodejs-private/security-release#51
1 parent 440f3f6 commit 0f925ad

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

lib/prepare_security.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ export default class PrepareSecurityRelease extends SecurityRelease {
5555
// For now, close the ones with Security Release label
5656
await this.closePRWithLabel('Security Release');
5757

58+
if (vulnerabilityJSON.buildIssue) {
59+
this.cli.info('Commenting on nodejs/build issue');
60+
await this.req.commentIssue(
61+
vulnerabilityJSON.buildIssue,
62+
'Security release is out'
63+
);
64+
}
65+
66+
if (vulnerabilityJSON.dockerIssue) {
67+
this.cli.info('Commenting on nodejs/docker-node issue');
68+
await this.req.commentIssue(
69+
vulnerabilityJSON.dockerIssue,
70+
'Security release is out'
71+
);
72+
}
73+
5874
const updateFolder = await this.cli.prompt(
5975
`Would you like to update the next-security-release folder to ${
6076
vulnerabilityJSON.releaseDate}?`,

lib/request.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,23 @@ export default class Request {
8181
return this.json(url, options);
8282
}
8383

84+
async commentIssue(fullUrl, comment) {
85+
const commentUrl = fullUrl.replace('https://github.com/', 'https://api.github.com/repos/') +
86+
'/comments';
87+
const options = {
88+
method: 'POST',
89+
headers: {
90+
Authorization: `Basic ${this.credentials.github}`,
91+
'User-Agent': 'node-core-utils',
92+
Accept: 'application/vnd.github+json'
93+
},
94+
body: JSON.stringify({
95+
body: comment,
96+
})
97+
};
98+
return this.json(commentUrl, options);
99+
}
100+
84101
async getPullRequest(fullUrl) {
85102
const prUrl = fullUrl.replace('https://github.com/', 'https://api.github.com/repos/').replace('pull', 'pulls');
86103
const options = {

0 commit comments

Comments
 (0)