# action-junit-report **Repository Path**: mirrors_StarRocks/action-junit-report ## Basic Information - **Project Name**: action-junit-report - **Description**: Reports junit test results as GitHub Pull Request Check - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-06-25 - **Last Updated**: 2025-12-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
... reports JUnit test results as GitHub pull request check.
What's included 🚀 • Setup 🛠️ • Sample 🖥️ • Contribute 🧬 • License 📓
------- ### What's included 🚀 - Flexible JUnit parser with wide support - Supports nested test suites - Blazingly fast execution - Lighweight - Rich build log output This action processes JUnit XML test reports on pull requests and shows the result as a PR check with summary and annotations. Based on action for [Surefire Reports by ScaCap](https://github.com/ScaCap/action-surefire-report) ## Setup ### Configure the workflow ```yml 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: # execute your tests generating test results - name: Publish Test Report uses: mikepenz/action-junit-report@v3 if: success() || failure() # always run even if the previous step fails with: report_paths: '**/build/test-results/test/TEST-*.xml' ``` ### Inputs | **Input** | **Description** | |----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `report_paths` | **Required**. [Glob](https://github.com/actions/toolkit/tree/master/packages/glob) expression to junit report paths. The default is `**/junit-reports/TEST-*.xml`. | | `token` | Optional. GitHub token for creating a check run. Set to `${{ github.token }}` by default. | | `test_files_prefix` | Optional. Prepends the provided prefix to test file paths within the report when annotating on GitHub. | | `exclude_sources` | Optional. Provide `,` seperated array of folders to ignore for source lookup. Defaults to: `/build/,/__pycache__/` | | `check_name` | Optional. Check name to use when creating a check run. The default is `JUnit Test Report`. | | `suite_regex` | Optional. Regular expression for the named test suites. E.g. `Test*` | | `commit` | Optional. The commit SHA to update the status. This is useful when you run it with `workflow_run`. | | `fail_on_failure` | Optional. Fail the build in case of a test failure. | | `require_tests` | Optional. Fail if no test are found. | | `include_passed` | Optional. By default the action will skip passed items for the annotations. Enable this flag to include them. | | `check_retries` | Optional. If a testcase is retried, ignore the original failure. | | `check_title_template` | Optional. Template to configure the title format. Placeholders: {{FILE_NAME}}, {{SUITE_NAME}}, {{TEST_NAME}}. | | `summary` | Optional. Additional text to summary output | | `update_check` | Optional. Uses an alternative API to update checks, use for cases with more than 50 annotations. Default: `false`. | | `annotate_only` | Optional. Will only annotate the results on the files, won't create a check run. Defaults to `false`. | | `transformers` | Optional. Array of `Transformer`s offering the ability to adjust the fileName. Defaults to: `[{"searchValue":"::","replaceValue":"/"}]` | | `job_summary` | Optional. Enables the publishing of the job summary for the results. Defaults to `true`. May be required to disable [Enterprise Server](https://github.com/mikepenz/action-junit-report/issues/637) | | `detailed_summary` | Optional. Include table with all test results in the summary. Defaults to `false`. | | `annotate_notice` | Optional. Annotate passed test results along with warning/failed ones. Defaults to `false`. (Changed in v3.5.0) | | `follow_symlink` | Optional. Enables to follow symlinks when searching test files via the globber. Defaults to `false`. | | `job_name` | Optional. Specify the name of a check to update | | `annotations_limit` | Optional. Specify the limit for annotations. This will also interrupt parsing all test-suites if the limit is reached. Defaults to: `No Limit`. | ### Action outputs After action execution it will return the test counts as output. ```yml # ${{steps.{CHANGELOG_STEP_ID}.outputs.total}} ``` A full set list of possible output values for this action. | **Output** | **Description** | |-----------------------|----------------------------------------------------------------------------------------| | `outputs.total` | The total number of test cases covered by this test-step. | | `outputs.passed` | The number of passed test cases. | | `outputs.skipped` | The number of skipped test cases. | | `outputs.failed` | The number of failed test cases. | ### PR run permissions The action requires `write` permission on the checks. If the GA token is `read-only` (this is a repository configuration) please enable `write` permission via: ```yml permissions: checks: write ``` Additionally for [security reasons], the github token used for `pull_request` workflows is [marked as read-only]. If you want to post checks to a PR from an external repository, you will need to use a separate workflow which has a read/write token, or use a PAT with elevated permissions. [security reasons]: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ [marked as read-only]: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token```yml name: build on: pull_request: jobs: build: name: Build and Run Tests runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v3 - name: Build and Run Tests run: # execute your tests generating test results - name: Upload Test Report uses: actions/upload-artifact@v3 if: always() # always run even if the previous step fails with: name: junit-test-results path: '**/build/test-results/test/TEST-*.xml' retention-days: 1 --- name: report on: workflow_run: workflows: [build] types: [completed] permissions: checks: write jobs: checks: runs-on: ubuntu-latest steps: - name: Download Test Report uses: dawidd6/action-download-artifact@v2 with: name: junit-test-results workflow: ${{ github.event.workflow.id }} run_id: ${{ github.event.workflow_run.id }} - name: Publish Test Report uses: mikepenz/action-junit-report@v3 with: commit: ${{github.event.workflow_run.head_sha}} report_paths: '**/build/test-results/test/TEST-*.xml' ``` This will securely post the check results from the privileged workflow onto the PR's checks report.