Skip to content
Latchkey

How to Post Test Results as a Check Run in GitHub Actions

A failing test buried in a 2,000-line log is hard to find; a check run surfaces the failures right on the PR.

Emit a JUnit XML report, then use a test-reporter action to create a check run with per-test annotations on the pull request.

Steps

  • Configure your test runner to emit JUnit XML.
  • Run tests with if: always() so a failure still produces the report.
  • Use a reporter action to publish the XML as a check run.
  • Grant checks: write permission.

Workflow

.github/workflows/test-report.yml
name: Test Report
on: [pull_request]
permissions:
  contents: read
  checks: write
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: '20' }
      - run: npm ci
      - run: npm test -- --reporters=jest-junit
        env: { JEST_JUNIT_OUTPUT_NAME: junit.xml }
      - if: always()
        uses: dorny/test-reporter@v1
        with:
          name: Jest Tests
          path: junit.xml
          reporter: jest-junit

Related guides

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