Skip to content

Commit 8d5fd4f

Browse files
Fix run-tutorial.yml in edge case (#1351)
1 parent 17bd3ff commit 8d5fd4f

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

Diff for: .github/workflows/run-tutorial.yml

+16-8
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,22 @@ jobs:
185185
- name: Check test results
186186
if: always()
187187
run: |
188-
if [ "${{ steps.run-tutorials.outputs.total }}" -eq 0 ]; then
189-
echo "::notice::No tutorials were tested in this group."
190-
elif [ "${{ steps.run-tutorials.outputs.failed }}" -gt 0 ]; then
191-
echo "::warning::${{ steps.run-tutorials.outputs.failed }} out of ${{ steps.run-tutorials.outputs.total }} tutorials failed. Read in Test tutorials and click `Running tutorials...` to see the error messages."
188+
# Read the outputs from the test step
189+
total="${{ steps.run-tutorials.outputs.total }}"
190+
failed="${{ steps.run-tutorials.outputs.failed }}"
191+
192+
# Default to 0 if empty to avoid bash errors
193+
total=${total:-0}
194+
failed=${failed:-0}
195+
196+
if [ "$total" -eq 0 ]; then
197+
echo "No tutorials were tested in this group."
198+
elif [ "$failed" -gt 0 ]; then
199+
echo "Warning: $failed out of $total tutorials failed."
200+
echo "Check the test results in the uploaded artifacts to see detailed error messages."
192201
else
193-
echo "::notice::All ${{ steps.run-tutorials.outputs.total }} tutorials passed."
202+
echo "Success: All $total tutorials passed."
194203
fi
195204
196-
# This ensures the job reports failure if any tutorials failed,
197-
# but without stopping other jobs in the matrix
198-
[ "${{ steps.run-tutorials.outputs.failed }}" -eq 0 ]
205+
# Return exit code based on failures
206+
exit $failed

0 commit comments

Comments
 (0)