@@ -30,7 +30,8 @@ class AnnotationApplier {
3030      processed : 0 , 
3131      modified : 0 , 
3232      errors : 0 , 
33-       skipped : 0 
33+       skipped : 0 , 
34+       modifiedFiles : [ ] 
3435    } ; 
3536  } 
3637
@@ -186,9 +187,10 @@ class AnnotationApplier {
186187  } 
187188
188189  isActionFile ( fileName ,  fullPath )  { 
190+     const  normalizedPath  =  fullPath . replace ( / \\ / g,  '/' ) ; 
189191    return  ( fileName . endsWith ( '.mjs' )  ||  fileName . endsWith ( '.ts' ) )  && 
190-            fullPath . includes ( '/actions/' )  && 
191-            ! fullPath . includes ( '/common/' ) ; 
192+            normalizedPath . includes ( '/actions/' )  && 
193+            ! normalizedPath . includes ( '/common/' ) ; 
192194  } 
193195
194196  extractActionKey ( fileContent )  { 
@@ -221,8 +223,15 @@ class AnnotationApplier {
221223  } 
222224
223225  applyAnnotations ( fileContent ,  annotations )  { 
224-     // Find and replace version 
225-     const  versionMatch  =  fileContent . match ( / ( .* v e r s i o n : \s * [ " ' ] ) ( [ ^ " ' ] + ) ( [ " ' ] , ? \s * \n ) / s) ; 
226+     // Find and replace version - handle both orders: type before version OR version before type 
227+     // Try lookahead first (version comes before type: "action") 
228+     let  versionMatch  =  fileContent . match ( / ( .* v e r s i o n : \s * [ " ' ] ) ( [ ^ " ' ] + ) ( [ " ' ] , ? \s * \n ) (? = [ \s \S ] * ?t y p e : \s * [ " ' ] a c t i o n [ " ' ] ) / s) ; 
229+     
230+     // If not found, try lookbehind (type: "action" comes before version) 
231+     if  ( ! versionMatch )  { 
232+       versionMatch  =  fileContent . match ( / (?< = t y p e : \s * [ " ' ] a c t i o n [ " ' ] [ \s \S ] { 0 , 1000 } ?) ( .* v e r s i o n : \s * [ " ' ] ) ( [ ^ " ' ] + ) ( [ " ' ] , ? \s * \n ) / s) ; 
233+     } 
234+     
226235    if  ( ! versionMatch )  { 
227236      throw  new  Error ( 'Could not find version field in file' ) ; 
228237    } 
@@ -270,7 +279,7 @@ class AnnotationApplier {
270279      const  modifiedContent  =  this . applyAnnotations ( fileContent ,  annotations ) ; 
271280      fs . writeFileSync ( filePath ,  modifiedContent ,  'utf8' ) ; 
272281
273-       this . recordModification ( fileContent ,  actionKey ) ; 
282+       this . recordModification ( fileContent ,  actionKey ,   filePath ) ; 
274283      return  true ; 
275284
276285    }  catch  ( error )  { 
@@ -290,8 +299,9 @@ class AnnotationApplier {
290299    this . log ( `Error processing ${ filePath }  : ${ error . message }  ` ,  'error' ) ; 
291300  } 
292301
293-   recordModification ( fileContent ,  actionKey )  { 
302+   recordModification ( fileContent ,  actionKey ,   filePath )  { 
294303    this . stats . modified ++ ; 
304+     this . stats . modifiedFiles . push ( filePath ) ; 
295305
296306    const  currentVersionMatch  =  fileContent . match ( / v e r s i o n : \s * [ " ' ] ( [ ^ " ' ] + ) [ " ' ] / ) ; 
297307    const  currentVersion  =  currentVersionMatch  ? currentVersionMatch [ 1 ]  : 'unknown' ; 
@@ -341,6 +351,12 @@ class AnnotationApplier {
341351      this . log ( '\n=== ERRORS ===' ) ; 
342352      this . errors . forEach ( error  =>  this . log ( error ,  'error' ) ) ; 
343353    } 
354+ 
355+     // Output modified files as JSON 
356+     if  ( this . stats . modifiedFiles . length  >  0 )  { 
357+       this . log ( '\n=== MODIFIED FILES (JSON) ===' ) ; 
358+       console . log ( JSON . stringify ( this . stats . modifiedFiles ,  null ,  2 ) ) ; 
359+     } 
344360  } 
345361
346362  async  run ( )  { 
0 commit comments