Skip to content
Latchkey

How to Publish Test Results as a Check with GitHub Actions

A test-reporter action parses your JUnit XML and publishes a check run, so failures show inline on the PR.

Have your runner emit JUnit XML, then run dorny/test-reporter to parse it and create a check run. Failed tests are annotated directly on the pull request, which is faster to read than raw logs.

Steps

  • Configure your runner to write a JUnit XML report.
  • Run dorny/test-reporter, pointing path at the report.
  • Grant checks: write so the action can create the check run.

Workflow

.github/workflows/ci.yml
permissions:
  contents: read
  checks: write
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npx jest --reporters=default --reporters=jest-junit
      - uses: dorny/test-reporter@v1
        if: always()
        with:
          name: Jest tests
          path: junit.xml
          reporter: jest-junit

Gotchas

  • Use if: always() so the report publishes even when tests fail.
  • From a forked PR the token is read-only; run the reporter from a workflow_run event instead.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →