Skip to content

Commit 25ea992

Browse files
authored
feat: use sec release template in PR description (#832)
* feat: use sec release template in PR description * fixup! feat: use sec release template in PR description
1 parent 88c31eb commit 25ea992

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

lib/prepare_security.js

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
NEXT_SECURITY_RELEASE_BRANCH,
77
NEXT_SECURITY_RELEASE_FOLDER,
88
NEXT_SECURITY_RELEASE_REPOSITORY,
9-
PLACEHOLDERS,
109
checkoutOnSecurityReleaseBranch,
1110
commitAndPushVulnerabilitiesJSON,
1211
validateDate,
@@ -37,22 +36,15 @@ export default class PrepareSecurityRelease {
3736
const createVulnerabilitiesJSON = await this.promptVulnerabilitiesJSON();
3837

3938
let securityReleasePRUrl;
39+
const content = await this.buildDescription(releaseDate, securityReleasePRUrl);
4040
if (createVulnerabilitiesJSON) {
41-
securityReleasePRUrl = await this.startVulnerabilitiesJSONCreation(releaseDate);
41+
securityReleasePRUrl = await this.startVulnerabilitiesJSONCreation(releaseDate, content);
4242
}
4343

44-
const createIssue = await this.promptCreateRelaseIssue();
45-
46-
if (createIssue) {
47-
const content = await this.buildIssue(releaseDate, securityReleasePRUrl);
48-
await createIssue(
49-
this.title, content, this.repository, { cli: this.cli, repository: this.repository });
50-
};
51-
5244
this.cli.ok('Done!');
5345
}
5446

55-
async startVulnerabilitiesJSONCreation(releaseDate) {
47+
async startVulnerabilitiesJSONCreation(releaseDate, content) {
5648
// checkout on the next-security-release branch
5749
checkoutOnSecurityReleaseBranch(this.cli, this.repository);
5850

@@ -87,7 +79,7 @@ export default class PrepareSecurityRelease {
8779
if (!createPr) return;
8880

8981
// create pr on the security-release repo
90-
return this.createPullRequest();
82+
return this.createPullRequest(content);
9183
}
9284

9385
promptCreatePR() {
@@ -143,11 +135,9 @@ export default class PrepareSecurityRelease {
143135
{ defaultAnswer: true });
144136
}
145137

146-
async buildIssue(releaseDate, securityReleasePRUrl = PLACEHOLDERS.vulnerabilitiesPRURL) {
138+
async buildDescription() {
147139
const template = await this.getSecurityIssueTemplate();
148-
const content = template.replace(PLACEHOLDERS.releaseDate, releaseDate)
149-
.replace(PLACEHOLDERS.vulnerabilitiesPRURL, securityReleasePRUrl);
150-
return content;
140+
return template;
151141
}
152142

153143
async chooseReports() {
@@ -185,11 +175,11 @@ export default class PrepareSecurityRelease {
185175
return fullPath;
186176
}
187177

188-
async createPullRequest() {
178+
async createPullRequest(content) {
189179
const { owner, repo } = this.repository;
190180
const response = await this.req.createPullRequest(
191181
this.title,
192-
'List of vulnerabilities to be included in the next security release',
182+
content ?? 'List of vulnerabilities to be included in the next security release',
193183
{
194184
owner,
195185
repo,

0 commit comments

Comments
 (0)