Skip to content

Commit f7cabe5

Browse files
Copilotfelickz
andauthored
Fix validate-test-results CI step: use find instead of glob, fix jq quoting
Agent-Logs-Url: https://github.com/GitHubSecurityLab/CodeQL-Community-Packs/sessions/4c10e063-602b-451a-aac5-30643a92609c Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
1 parent f330fcd commit f7cabe5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,17 @@ jobs:
132132

133133
- name: Validate test results
134134
run: |
135-
if [[ ! -n "$(find . -name 'test_report_*' -print -quit)" ]]; then
135+
mapfile -t test_reports < <(find . -name 'test_report_*.json')
136+
if [[ ${#test_reports[@]} -eq 0 ]]; then
136137
echo "No test results found"
137138
exit 0
138139
fi
139140
140-
for json_report in *-test-results/test_report_*
141+
for json_report in "${test_reports[@]}"
141142
do
142-
jq --raw-output '"PASS \(map(select(.pass == true)) | length)/\(length)'" $json_report\"" "$json_report"
143+
jq --raw-output '"PASS \(map(select(.pass == true)) | length)/\(length)"' "$json_report"
143144
done
144-
FAILING_TESTS=$(jq --raw-output '.[] | select(.pass == false)' *-test-results/test_report_*.json)
145+
FAILING_TESTS=$(jq --raw-output '.[] | select(.pass == false)' "${test_reports[@]}")
145146
if [[ ! -z "$FAILING_TESTS" ]]; then
146147
echo "ERROR: The following tests failed:"
147148
echo $FAILING_TESTS | jq .

0 commit comments

Comments
 (0)