|
6 | 6 | NEXT_SECURITY_RELEASE_BRANCH,
|
7 | 7 | NEXT_SECURITY_RELEASE_FOLDER,
|
8 | 8 | NEXT_SECURITY_RELEASE_REPOSITORY,
|
9 |
| - PLACEHOLDERS, |
10 | 9 | checkoutOnSecurityReleaseBranch,
|
11 | 10 | commitAndPushVulnerabilitiesJSON,
|
12 | 11 | validateDate,
|
@@ -37,22 +36,15 @@ export default class PrepareSecurityRelease {
|
37 | 36 | const createVulnerabilitiesJSON = await this.promptVulnerabilitiesJSON();
|
38 | 37 |
|
39 | 38 | let securityReleasePRUrl;
|
| 39 | + const content = await this.buildDescription(releaseDate, securityReleasePRUrl); |
40 | 40 | if (createVulnerabilitiesJSON) {
|
41 |
| - securityReleasePRUrl = await this.startVulnerabilitiesJSONCreation(releaseDate); |
| 41 | + securityReleasePRUrl = await this.startVulnerabilitiesJSONCreation(releaseDate, content); |
42 | 42 | }
|
43 | 43 |
|
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 |
| - |
52 | 44 | this.cli.ok('Done!');
|
53 | 45 | }
|
54 | 46 |
|
55 |
| - async startVulnerabilitiesJSONCreation(releaseDate) { |
| 47 | + async startVulnerabilitiesJSONCreation(releaseDate, content) { |
56 | 48 | // checkout on the next-security-release branch
|
57 | 49 | checkoutOnSecurityReleaseBranch(this.cli, this.repository);
|
58 | 50 |
|
@@ -87,7 +79,7 @@ export default class PrepareSecurityRelease {
|
87 | 79 | if (!createPr) return;
|
88 | 80 |
|
89 | 81 | // create pr on the security-release repo
|
90 |
| - return this.createPullRequest(); |
| 82 | + return this.createPullRequest(content); |
91 | 83 | }
|
92 | 84 |
|
93 | 85 | promptCreatePR() {
|
@@ -143,11 +135,9 @@ export default class PrepareSecurityRelease {
|
143 | 135 | { defaultAnswer: true });
|
144 | 136 | }
|
145 | 137 |
|
146 |
| - async buildIssue(releaseDate, securityReleasePRUrl = PLACEHOLDERS.vulnerabilitiesPRURL) { |
| 138 | + async buildDescription() { |
147 | 139 | const template = await this.getSecurityIssueTemplate();
|
148 |
| - const content = template.replace(PLACEHOLDERS.releaseDate, releaseDate) |
149 |
| - .replace(PLACEHOLDERS.vulnerabilitiesPRURL, securityReleasePRUrl); |
150 |
| - return content; |
| 140 | + return template; |
151 | 141 | }
|
152 | 142 |
|
153 | 143 | async chooseReports() {
|
@@ -185,11 +175,11 @@ export default class PrepareSecurityRelease {
|
185 | 175 | return fullPath;
|
186 | 176 | }
|
187 | 177 |
|
188 |
| - async createPullRequest() { |
| 178 | + async createPullRequest(content) { |
189 | 179 | const { owner, repo } = this.repository;
|
190 | 180 | const response = await this.req.createPullRequest(
|
191 | 181 | 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', |
193 | 183 | {
|
194 | 184 | owner,
|
195 | 185 | repo,
|
|
0 commit comments