Skip to content

Commit 93a7532

Browse files
authored
Update main.yml (#200)
1 parent 385eb56 commit 93a7532

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

.github/workflows/main.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,21 @@ jobs:
3434
id: set-matrix
3535
run: |
3636
# Group the output by platform.
37-
GROUPS=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/check-runs" --paginate \
38-
--jq '.check_runs[] | select(.name | endswith("-env")) | { "config": .name, "build_path": .output.text }' | \
39-
jq --slurp -c -r '. as $jobs | map(.config | split(".") | first) | unique | map(. as $group | {"platform": $group, "jobs": $jobs | map(select(.config |startswith($group)))})')
40-
echo "matrix=${GROUPS}" >> $GITHUB_OUTPUT
37+
set -x
38+
CHECK_RUNS=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/check-runs" --paginate)
39+
echo "Check Runs: $CHECK_RUNS"
40+
41+
FILTERED=$(echo "$CHECK_RUNS" | jq -r '.check_runs[] | select(.name | endswith("-env")) | { "config": .name, "build_path": .output.text }')
42+
echo "Filtered: $FILTERED"
43+
44+
GROUPS=$(echo "$FILTERED" | jq --slurp -c -r '. as $jobs | map(.config | split(".") | first) | unique | map(. as $group | {"platform": $group, "jobs": $jobs | map(select(.config |startswith($group)))})')
45+
if jq -e . <<< "$GROUPS" > /dev/null 2>&1; then # JSON validation
46+
echo "Valid JSON"
47+
else
48+
echo "Invalid JSON: $GROUPS"
49+
exit 1 # or handle the error appropriately
50+
fi
51+
echo "matrix=$GROUPS" >> $GITHUB_OUTPUT
4152
4253
# We need this process step in here, because we have in excess of 256 jobs.
4354
process:

0 commit comments

Comments
 (0)