name: Report test results
on:
  workflow_run:
    workflows: ["Build and test"]
    types:
      - completed

jobs:
  test_report:
    runs-on: ubuntu-latest
    steps:
    - name: Download test results to report
      uses: dawidd6/action-download-artifact@v2
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        workflow: ${{ github.event.workflow_run.workflow_id }}
        commit: ${{ github.event.workflow_run.head_commit.id }}
    - name: Check if JUnit report XML files exist
      run: |
        if ls **/target/test-reports/*.xml > /dev/null 2>&1; then
          echo '::set-output name=FILE_EXISTS::true'
        else
          echo '::set-output name=FILE_EXISTS::false'
        fi
      id: check-junit-file
    - name: Publish test report
      if: steps.check-junit-file.outputs.FILE_EXISTS == 'true'
      uses: scacap/action-surefire-report@v1
      with:
        check_name: Report test results
        github_token: ${{ secrets.GITHUB_TOKEN }}
        report_paths: "**/target/test-reports/*.xml"
        commit: ${{ github.event.workflow_run.head_commit.id }}

name: Report test results
on:
  workflow_run:
    workflows: ["Build and test"]
    types:
      - completed

jobs:
  test_report:
    runs-on: ubuntu-latest
    steps:
    - name: Download test results to report
      uses: dawidd6/action-download-artifact@v2
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        workflow: ${{ github.event.workflow_run.workflow_id }}
        commit: ${{ github.event.workflow_run.head_commit.id }}
    - name: Publish test report
      uses: scacap/action-surefire-report@v1
      with:
        check_name: Report test results
        github_token: ${{ secrets.GITHUB_TOKEN }}
        report_paths: "**/target/test-reports/*.xml"
        commit: ${{ github.event.workflow_run.head_commit.id }}

Revert "[SPARK-33069][INFRA] Skip test result report if no JUnit XML files are found"
Revert "[SPARK-33069][INFRA] Skip test result report if no JUnit XML files are found"

This reverts commit a0aa8f33a9420feb9228b51a3dfad2e7e86d65a5.
