This action processes maven surefire or failsafe XML reports on pull requests and shows the result as a PR check with summary and annotations.
Required. Usually in form of github_token: ${{ secrets.GITHUB_TOKEN }}.
Optional. Glob expression to surefire or failsafe report paths. The default is **/surefire-reports/TEST-*.xml.
Optional. Check name to use when creating a check run. The default is Test Report.
Optional. The commit sha to update the status. This is useful when you run it with workflow_run.
Optional. Check will fail if there are test failures. The default is false.
Optional. Check will fail if no tests were found. The default is true.
name: build
on:
  pull_request:
jobs:
  build:
    name: Build and Run Tests
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v1
      - name: Build and Run Tests
        run: mvn test --batch-mode --fail-at-end
      - name: Publish Test Report
        if: ${{ always() }}
        uses: scacap/action-surefire-report@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}As Gradle uses a different build directory than Maven by default, you might need to set the report_paths variable:
    report_paths: '**/build/test-results/test/TEST-*.xml'You also need to enable JUnit XML reports as shown below.
test {
  reports {
    junitXml.enabled = true
  }
}