@@ -80,28 +80,23 @@ export default class SecurityBlog extends SecurityRelease {
8080 async updateAnnouncementLink ( link ) {
8181 const vulnerabilitiesJSONPath = this . getVulnerabilitiesJSONPath ( ) ;
8282 const content = this . readVulnerabilitiesJSON ( vulnerabilitiesJSONPath ) ;
83- let shouldCommit = false ;
84- for ( let i = 0 ; i < content . reports . length ; ++ i ) {
85- if ( content . reports [ i ] . announcement !== link ) {
86- content . reports [ i ] . announcement = link ;
87- shouldCommit = true ;
88- }
89- } ;
9083
91- if ( shouldCommit ) {
92- await writeSecurityFile (
93- this . cli ,
94- vulnerabilitiesJSONPath ,
95- JSON . stringify ( content , null , 2 ) ,
96- 'This writes the announcement link to each report in vulnerabilities.json.'
97- ) ;
98- const commitMessage = 'chore: add announcement link' ;
99- await commitAndPushVulnerabilitiesJSON ( [ vulnerabilitiesJSONPath ] ,
100- commitMessage , { cli : this . cli , repository : this . repository } ) ;
101-
102- this . cli . ok ( 'Updated the announcement link in vulnerabilities.json' ) ;
84+ if ( content . announcement === link ) {
85+ return [ vulnerabilitiesJSONPath ] ;
10386 }
10487
88+ content . announcement = link ;
89+ await writeSecurityFile (
90+ this . cli ,
91+ vulnerabilitiesJSONPath ,
92+ JSON . stringify ( content , null , 2 ) ,
93+ 'This writes the announcement link to vulnerabilities.json.'
94+ ) ;
95+ const commitMessage = 'chore: add announcement link' ;
96+ await commitAndPushVulnerabilitiesJSON ( [ vulnerabilitiesJSONPath ] ,
97+ commitMessage , { cli : this . cli , repository : this . repository } ) ;
98+
99+ this . cli . ok ( 'Updated the announcement link in vulnerabilities.json' ) ;
105100 return [ vulnerabilitiesJSONPath ] ;
106101 }
107102
0 commit comments