@@ -78,10 +78,15 @@ jobs:
7878 echo "Crates to Build: ${crates[*]}"
7979
8080 matrix='{"system": ["x86_64-linux","aarch64-linux","x86_64-windows","aarch64-windows","x86_64-darwin","aarch64-darwin"],"crate": ['
81+ addedAtLeastOne=false
8182 for crate in "${crates[@]}"; do
8283 matrix+="\"$crate\","
84+ addedAtLeastOne=true
8385 done
84- matrix="${matrix::-1}]}"
86+ if [ "$addedAtLeastOne" = true ]; then
87+ matrix="${matrix::-1}"
88+ fi
89+ matrix="${matrix}]}"
8590
8691 echo "$matrix" | jq .
8792 echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
@@ -123,7 +128,7 @@ jobs:
123128
124129 determine-tests :
125130 needs : [ get-changes, build-artifacts ]
126- if : ${{ needs.get-changes.outputs.matrix != '{}' && always() }}
131+ if : ${{ always() && needs.get-changes.outputs.matrix != '{}' }}
127132 runs-on : ubuntu-latest
128133 outputs :
129134 test-matrix : ${{ steps.get-test-matrix.outputs.matrix }}
@@ -161,12 +166,17 @@ jobs:
161166 fi
162167
163168 matrix='{"system": ["x86_64-linux","aarch64-linux","x86_64-windows","aarch64-windows","x86_64-darwin","aarch64-darwin"], "crate": ['
169+ addedAtLeastOne=false
164170 for crate in "${!found_artifacts[@]}"; do
165171 systems=${found_artifacts["$crate"]}
166172 systems=${systems::-1}
167173 matrix+="{\"name\": \"$crate\", \"systems\": [\"${systems//,/\",\"}\"]},"
174+ addedAtLeastOne=true
168175 done
169- matrix="${matrix::-1}]}"
176+ if [ "$addedAtLeastOne" = true ]; then
177+ matrix="${matrix::-1}"
178+ fi
179+ matrix="${matrix}]}"
170180
171181 echo "$matrix" | jq .
172182 echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
0 commit comments