Skip to content

Commit cf6315f

Browse files
committed
Handle empty build results in cache counting logic
- Implement explicit is-empty check for build results - Prevent errors by assigning zero when results are empty - Remove use of default in total calculation for improved accuracy
1 parent de3986b commit cf6315f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.github/workflows/cachix-push.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,17 @@ jobs:
7575
}
7676
})
7777
78-
# Calculate totals (default to 0 if empty)
79-
let total_paths_count = ($build_results_with_cache_info | get path_count | default 0 | math sum)
80-
let total_cached_count = ($build_results_with_cache_info | get cached_count | default 0 | math sum)
78+
# Calculate totals (handle empty results)
79+
let total_paths_count = if ($build_results_with_cache_info | is-empty) {
80+
0
81+
} else {
82+
($build_results_with_cache_info | get path_count | math sum)
83+
}
84+
let total_cached_count = if ($build_results_with_cache_info | is-empty) {
85+
0
86+
} else {
87+
($build_results_with_cache_info | get cached_count | math sum)
88+
}
8189
8290
# Build summary
8391
let package_table = ($build_results_with_cache_info | each {|pkg|

0 commit comments

Comments
 (0)