@@ -118,17 +118,16 @@ var rootCmd = &cobra.Command{
118118 updated , err := UpdateWorkflowActionSHAs (ctx , client , filePath )
119119 if err != nil {
120120 // Log errors related to processing a single file but continue to the next.
121- log .Printf ("❌ Failed to process %s: %v" , filePath , err )
121+ log .Printf ("❌ Failed to process %s: %v" , filePath , err )
122122 } else if updated > 0 {
123123 // Log success if updates were made.
124- log .Printf ("✅ Updated %d action(s) in %s" , updated , filePath )
124+ log .Printf ("✅ Updated %d action(s) in %s" , updated , filePath )
125125 totalUpdates += updated
126126 } else {
127127 // Log if no updates were needed for the file.
128- log .Printf ("ℹ️ No actions needed updating in %s" , filePath )
128+ log .Printf ("ℹ️ No actions needed updating in %s" , filePath )
129129 }
130130 }
131-
132131 // Final summary of total updates made across all files.
133132 log .Printf ("Finished processing. Total actions updated across all files: %d" , totalUpdates )
134133 },
@@ -265,7 +264,7 @@ func handleUsesValue(
265264 }
266265
267266 // If the reference is not a SHA, attempt to resolve it to a full SHA using the GitHub API.
268- log .Printf ("🔍 Resolving SHA for: %s/%s@%s (line %d)" , action .Name ,
267+ log .Printf ("🔍 Resolving SHA for: %s/%s@%s (line %d)" , action .Name ,
269268 action .Repo ,
270269 action .Ref ,
271270 lineNum ,
@@ -441,11 +440,19 @@ func applyUpdatesToLines(originalContent string, updates map[int]string) (string
441440 // Trim whitespace from the beginning of the line to check if it starts with 'uses:'.
442441 trimmedLine := strings .TrimSpace (line )
443442 // Verify that the line actually starts with 'uses:' (case-sensitive as per YAML spec).
444- if strings .HasPrefix (trimmedLine , "uses:" ) {
443+ if strings .HasPrefix (trimmedLine , "uses:" ) ||
444+ strings .HasPrefix (trimmedLine , "- uses:" ) {
445445 // Identify the leading indentation (spaces and tabs) of the original line.
446446 indentation := line [:len (line )- len (strings .TrimLeft (line , " \t " ))]
447- // Construct the new line by adding the original indentation, "uses: ", and the new value.
448- newLine := indentation + "uses: " + newUsesValue
447+ // Construct the new line, preserving the dash if it exists
448+ newLine := ""
449+ if strings .HasPrefix (trimmedLine , "- uses:" ) {
450+ // If it has the dash prefix, maintain it in the updated line
451+ newLine = indentation + "- uses: " + newUsesValue
452+ } else {
453+ // Regular "uses:" line without dash
454+ newLine = indentation + "uses: " + newUsesValue
455+ }
449456 // Write the new line to the output buffer.
450457 output .WriteString (newLine )
451458 } else {
0 commit comments