Skip to content

Commit 825dd85

Browse files
committed
chore: use list operations
1 parent 4ab2e18 commit 825dd85

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

.github/workflows/dockerhub-release-matrix.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,19 @@ jobs:
202202
id: combine
203203
run: |
204204
nix run nixpkgs#nushell -- -c '
205-
let combined_results = []
206-
207-
ls **/results.txt | each { |result_file|
208-
let results = (open $result_file | lines | where { $it != "" })
209-
$combined_results = $combined_results + $results
210-
}
211-
212-
let matrix = ($combined_results | each { { version: $it } }) | to json
213-
$"matrix=$matrix" | save --append $env.GITHUB_OUTPUT
205+
# Get all results files and process them in one go
206+
let matrix = (
207+
ls **/results.txt
208+
| get name # Get just the file paths
209+
| each { |file| open $file } # Open each file
210+
| each { |content| $content | lines } # Split into lines
211+
| flatten # Flatten the nested lists
212+
| where { |line| $line != "" } # Filter empty lines
213+
| each { |line| {version: $line} } # Create objects
214+
| to json # Convert to JSON
215+
)
216+
217+
$"matrix=($matrix)" | save --append $env.GITHUB_OUTPUT
214218
'
215219
- name: Debug Combined Results
216220
run: |

0 commit comments

Comments
 (0)