File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -124,8 +124,25 @@ jobs:
124124 export PATH
125125 fi
126126
127- ls */matrix-pre.json
128- matrix="$(cat */matrix-pre.json | jq -cr '.include[]' | jq '[ select (.isCached == false) ]' | jq -s 'add' | jq -c '. | {include: .}')"
127+ matrix_files=()
128+ while IFS= read -r -d '' file; do
129+ matrix_files+=("$file")
130+ done < <(find . -type f -name 'matrix-pre.json' -print0 | sort -z)
131+
132+ if [[ "${#matrix_files[@]}" -eq 0 ]]; then
133+ echo "No matrix-pre.json artifacts found" >&2
134+ exit 1
135+ fi
136+
137+ echo "Found matrix-pre.json files:"
138+ for file in "${matrix_files[@]}"; do
139+ ls "$file"
140+ done
141+
142+ matrix="$(jq -sc '
143+ [.[].include[]? | select(.isCached == false)] as $filtered
144+ | {include: $filtered}
145+ ' "${matrix_files[@]}")"
129146
130147 if [[ "$matrix" == '' ]] || [[ "$matrix" == '{}' ]] || [[ "$matrix" == '{"include":null}' ]] || [[ "$matrix" == '{"include":[]}' ]]; then
131148 matrix='{"include":[]}'
@@ -138,7 +155,10 @@ jobs:
138155 echo
139156 echo
140157
141- fullMatrix="$(cat */matrix-pre.json | jq -cr '.include' | jq -s 'add' | jq -c '. | {include: .}')"
158+ fullMatrix="$(jq -sc '
159+ [.[].include[]?] as $all
160+ | {include: $all}
161+ ' "${matrix_files[@]}")"
142162
143163 echo "---"
144164 echo "Full Matrix:"
You can’t perform that action at this time.
0 commit comments