GitHub Target ​
The GitHub target publishes test results as comments on GitHub pull requests. It supports both functional test results and performance test results with rich formatting and customizable content.
Overview ​
This target automatically posts test summaries to GitHub PR comments, making it easy for teams to review test results directly in their pull request workflow. It can create new comments or update existing ones based on configuration.
Configuration ​
Basic Configuration ​
{
"targets": [
{
"name": "github",
"inputs": {
"token": "your-github-token"
}
}
]
}
TIP
GITHUB_TOKEN
is automatically set by GitHub Actions. You can use it by passing it as an argument to the publish
command.
- name: Publish Results
run: npx testbeats publish --github {GITHUB_TOKEN} --junit 'results/junit.xml'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Complete Configuration ​
{
"targets": [
{
"name": "github",
"inputs": {
"token": "your-github-token",
"owner": "your-org",
"repo": "your-repo",
"pull_number": "123",
"title": "Custom Test Title",
"title_suffix": "- Build #456",
"title_link": "https://your-ci-system.com/build/456",
"include_suites": true,
"include_failure_details": true,
"only_failures": false,
"max_suites": 10,
"duration": "long",
"publish": "test-summary"
}
}
]
}
Input Parameters ​
Parameter | Type | Default | Description |
---|---|---|---|
token | string | undefined | GitHub personal access token or use GITHUB_TOKEN environment variable |
owner | string | undefined | GitHub repository owner (auto-detected in GitHub Actions) |
repo | string | undefined | GitHub repository name (auto-detected in GitHub Actions) |
pull_number | string | undefined | Pull request number (auto-detected in GitHub Actions) |
title | string | undefined | Custom title for the test results (defaults to result name) |
title_suffix | string | undefined | Additional text to append to the title |
title_link | string | undefined | URL to make the title clickable |
include_suites | boolean | true | Whether to include individual suite results |
include_failure_details | boolean | false | Whether to include detailed failure information |
only_failures | boolean | false | Whether to show only failed suites |
max_suites | number | 10 | Maximum number of suites to display |
duration | string | "long" | Duration format: "long" , "short" , or "ms" |
publish | string | "test-summary" | Publish mode: "test-summary" , "test-summary-slim" , or "failure-details" |
Publish Modes ​
test-summary (default) ​
Complete test summary with suites and configurable details.
test-summary-slim ​
Compact summary without individual suite details (sets include_suites: false
).
failure-details ​
Focused on failure information (sets include_failure_details: true
).
Usage Examples ​
Basic Usage in GitHub Actions ​
name: Tests
on:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Tests
run: npm test
- name: Publish Results
run: npx testbeats publish --github {GITHUB_TOKEN} --junit 'results/junit.xml'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
With Custom Comment Title ​
{
"targets": [
{
"name": "github",
"inputs": {
"title": "đź§Ş E2E Test Results",
"include_failure_details": true
}
}
]
}