Skip to content

GitHub Output target ​

The github-output target appends lines to the file pointed to by the GITHUB_OUTPUT environment variable. Use it in GitHub Actions when downstream steps need the parsed test result object or TestBeats context stores as job outputs.

This is different from the GitHub target, which posts a summary comment on a pull request.

Output size

Job outputs are intended for small values. This target writes full JSON for the aggregated result and for stores, which can be large. You may hit GitHub Actions output limits or expose more data than you intend. Prefer the TestBeats Portal, artifacts, or a minimal custom integration when payloads are big or sensitive.

Configuration ​

json
{
  "name": "github-output",
  "inputs": {
    "key": "testbeats",
    "output_file": "/path/to/github_output"
  }
}

Inputs ​

InputTypeRequiredDescription
keystringNoPrefix for output names. Default: testbeats.
output_filestringNoFile path to append to. Default: value of the GITHUB_OUTPUT environment variable. In Actions, GITHUB_OUTPUT is set for you.

Written outputs ​

For key testbeats, two lines are appended in NAME=value form:

  • testbeats_results — JSON string of the parsed test result object.
  • testbeats_stores — JSON string of TestBeats context stores.

If you set key to myrun, the names become myrun_results and myrun_stores.

Example (GitHub Actions outline) ​

Use a JSON config file (the github-output target is not exposed as a publish CLI flag).

yaml
- name: Publish test results
  run: npx testbeats@latest publish -c .testbeats.json

GitHub Actions sets GITHUB_OUTPUT automatically for each step; you normally omit output_file in the target inputs.

Your .testbeats.json should include a target:

json
{
  "targets": [
    {
      "name": "github-output",
      "inputs": {
        "key": "testbeats"
      }
    }
  ],
  "results": [
    {
      "type": "junit",
      "files": ["reports/**/*.xml"]
    }
  ]
}

See also ​

Released under the MIT License.