From 825dd85c5601bca6b655206f174253ea0c67295f Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Fri, 20 Dec 2024 21:46:54 -0500 Subject: [PATCH] chore: use list operations --- .../workflows/dockerhub-release-matrix.yml | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dockerhub-release-matrix.yml b/.github/workflows/dockerhub-release-matrix.yml index 0b2b95fea..a9fd3e7b5 100644 --- a/.github/workflows/dockerhub-release-matrix.yml +++ b/.github/workflows/dockerhub-release-matrix.yml @@ -202,15 +202,19 @@ jobs: id: combine run: | nix run nixpkgs#nushell -- -c ' - let combined_results = [] - - ls **/results.txt | each { |result_file| - let results = (open $result_file | lines | where { $it != "" }) - $combined_results = $combined_results + $results - } - - let matrix = ($combined_results | each { { version: $it } }) | to json - $"matrix=$matrix" | save --append $env.GITHUB_OUTPUT + # Get all results files and process them in one go + let matrix = ( + ls **/results.txt + | get name # Get just the file paths + | each { |file| open $file } # Open each file + | each { |content| $content | lines } # Split into lines + | flatten # Flatten the nested lists + | where { |line| $line != "" } # Filter empty lines + | each { |line| {version: $line} } # Create objects + | to json # Convert to JSON + ) + + $"matrix=($matrix)" | save --append $env.GITHUB_OUTPUT ' - name: Debug Combined Results run: |