From d900c7b7c71da4c2a5ff1adc2cbc73b5fc7843b2 Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Mon, 12 Aug 2024 18:29:36 -0300 Subject: [PATCH 1/2] feat: update next-security-release folder on cleanup --- lib/prepare_security.js | 13 +++++++++++++ lib/security-release/security-release.js | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/lib/prepare_security.js b/lib/prepare_security.js index 003c4840..852fa85c 100644 --- a/lib/prepare_security.js +++ b/lib/prepare_security.js @@ -54,6 +54,19 @@ export default class PrepareSecurityRelease extends SecurityRelease { this.cli.info('Closing pull requests'); // For now, close the ones with vN.x label await this.closePRWithLabel(this.getAffectedVersions(vulnerabilityJSON)); + + const updateFolder = this.cli.prompt( + // eslint-disable-next-line max-len + `Would you like to update the next-security-release folder to ${vulnerabilityJSON.releaseDate}?`, + { defaultAnswer: true }); + if (updateFolder) { + const newFolder = this.updateReleaseFolder(vulnerabilityJSON.releaseDate); + commitAndPushVulnerabilitiesJSON( + newFolder, + 'update: change next-security-release folder', + { cli: this.cli, repository: this.repository } + ); + } this.cli.info(`Merge pull request with: - git checkout main - git merge --squash ${NEXT_SECURITY_RELEASE_BRANCH} diff --git a/lib/security-release/security-release.js b/lib/security-release/security-release.js index d8308a71..3a4482a7 100644 --- a/lib/security-release/security-release.js +++ b/lib/security-release/security-release.js @@ -233,6 +233,14 @@ export class SecurityRelease { NEXT_SECURITY_RELEASE_FOLDER, 'vulnerabilities.json'); } + updateReleaseFolder(releaseDate) { + const folder = path.join(process.cwd(), + NEXT_SECURITY_RELEASE_FOLDER); + const newFolder = path.join(process.cwd(), releaseDate); + fs.renameSync(folder, newFolder); + return newFolder; + } + updateVulnerabilitiesJSON(content) { try { const vulnerabilitiesJSONPath = this.getVulnerabilitiesJSONPath(); From d2bdef1d07863e9b7672468aaa1a6eb7557ab594 Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Wed, 14 Aug 2024 16:52:37 -0300 Subject: [PATCH 2/2] Update lib/prepare_security.js Co-authored-by: Marco Ippolito --- lib/prepare_security.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/prepare_security.js b/lib/prepare_security.js index 852fa85c..8d4ba962 100644 --- a/lib/prepare_security.js +++ b/lib/prepare_security.js @@ -63,7 +63,7 @@ export default class PrepareSecurityRelease extends SecurityRelease { const newFolder = this.updateReleaseFolder(vulnerabilityJSON.releaseDate); commitAndPushVulnerabilitiesJSON( newFolder, - 'update: change next-security-release folder', + 'chore: change next-security-release folder', { cli: this.cli, repository: this.repository } ); }