name: "Test Summary" description: "Creates a markdown table from test results and uploads a summary file" inputs: download-pattern: description: "The pattern to download test result rows" required: false default: test-result-* upload-name: description: "The artifact upload name for the summary" required: false default: summary-tests runs: using: "composite" steps: - name: Download test result rows uses: actions/download-artifact@v4 with: pattern: ${{ inputs.download-pattern }} merge-multiple: true path: rows - name: Build markdown table id: markdown-table run: | # Builds a markdown table from the row artifacts. header=$(cat <> $GITHUB_OUTPUT shell: bash - name: Set step summary id: summary run: | # Sets the step summary and creates a CI summary file. table="${{ steps.markdown-table.outputs.markdown }}" if [ -z "$table" ]; then echo "No test results found" | tee $GITHUB_STEP_SUMMARY >&2 exit 1 else echo "$table" > $GITHUB_STEP_SUMMARY fi count=$(echo "$table" | awk -v RS='' '{gsub(/[^❌]/, ""); print length}') file="ci-summary.md" if [ $count -gt 0 ]; then echo "❌🔬 Tests failed: $count" | tee $file echo "file=$file" >> $GITHUB_OUTPUT else # For debugging; don't send success to CI summary (reduce noise). echo > $file echo "✅🔬 All tests passed" fi shell: bash - name: Upload CI summary if: steps.summary.outputs.file uses: actions/upload-artifact@v4 with: name: ${{ inputs.upload-name }} path: ${{ steps.summary.outputs.file }} if-no-files-found: error