Generate GitHub Actions job summaries from Robot Framework results
Project description
robotframework-ghareports
robotframework-ghareports generates a GitHub Actions job summary from Robot Framework results.
It supports two workflows:
- Use it as a Robot Framework listener during a normal
robotrun. - Use it as a standalone CLI after execution, for example after pabot has merged results into a single
output.xml. - Optionally publish the generated report as a pull request comment.
The generated summary is written to GITHUB_STEP_SUMMARY when that environment variable is available. You can also write the same report to a separate Markdown file for local inspection or archival.
Example output: example_step_summary.md
What It Reports
The generated Markdown can include:
- Totals: passed, failed, skipped, total, pass rate, duration
- Passing tests
- Failing tests with failure messages
- Skipped tests with skip messages
- Warnings logged during test execution
- Selected environment variables
Long table cells can be wrapped to improve readability in GitHub's summary view.
When enabled, the same Markdown can also be published to the pull request as an updatable bot comment. This is useful when the GitHub step summary size limit becomes a constraint.
Installation
Install from PyPI:
python -m pip install robotframework-ghareports
The package exposes the ghareports command-line entry point.
Usage
Listener mode
Use the listener during a regular Robot Framework run:
robot --listener GHAReports path/to/tests
If GITHUB_STEP_SUMMARY is set, the listener writes directly to the GitHub Actions job summary.
CLI mode
Use the CLI when you already have a Robot Framework output.xml:
ghareports --robotlog output.xml
You can also invoke it as a module:
python -m GHAReports --robotlog output.xml
CLI mode is useful when results are produced in multiple steps and combined afterward before generating the final summary.
Writing to an Extra Markdown File
If you want a standalone Markdown report in addition to the GitHub summary, provide an output file.
Listener mode:
robot --listener GHAReports:report_file=extra_summary.md path/to/tests
CLI mode:
ghareports --robotlog output.xml --markdown extra_summary.md
This is also the recommended way to inspect output locally when you are not running inside GitHub Actions.
Publishing as a Pull Request Comment
If the GitHub Actions step summary is too limited for your use case, you can also publish the generated report as a pull request comment.
CLI mode:
ghareports --robotlog output.xml --pr-comment
Listener mode:
robot --listener GHAReports:pr_comment=True path/to/tests
The comment is upserted using a hidden marker, so repeated runs update the same bot comment instead of creating a new one every time.
This feature requires:
- a pull request workflow context
GITHUB_TOKENorGH_TOKENGITHUB_REPOSITORYGITHUB_EVENT_PATH
In GitHub Actions, make sure the workflow token has permission to write pull request comments:
permissions:
contents: read
pull-requests: write
Controlling Table Cell Width
To wrap long table cells after a fixed number of characters, set a width.
Listener mode:
robot --listener GHAReports:35 path/to/tests
CLI mode:
ghareports --robotlog output.xml --width 35
This is especially useful for long failure messages.
Including Environment Variables
You can include selected environment variables in the generated summary. This is useful when the same test assets run against multiple environments or browser combinations and that context should be visible in the job summary.
Example GitHub Actions job configuration:
jobs:
test:
runs-on: ubuntu-latest
env:
ENVIRONMENT: ${{ inputs.TEST_ENV }}
BROWSER: ${{ inputs.DEFAULT_BROWSER }}
RERUN_FAILED: ${{ inputs.RERUN_FAILED }}
Listener mode:
robot --listener GHAReports:env_variables=ENVIRONMENT,BROWSER,RERUN_FAILED path/to/tests
CLI mode:
ghareports --robotlog output.xml --envs ENVIRONMENT,BROWSER,RERUN_FAILED
Only variables that exist in the environment are included.
CLI Reference
ghareports --robotlog FILE [options]
Common options:
-r,--robotlog FILE: Robot Frameworkoutput.xmlpath. Default:output.xml-m,--markdown FILE: write the full report to an extra Markdown file-w,--width N: wrap table cell content afterNcharacters-e,--envs ENV1,ENV2,...: include selected environment variables in the summary--[no-]totals: include or exclude totals section--[no-]passes: include or exclude passing tests section--[no-]fails: include or exclude failing tests section--[no-]skipped: include or exclude skipped tests section--[no-]warnings: include or exclude warnings section--[no-]overwrite-summary: overwrite an existing GitHub summary instead of appending to it--[no-]pr-comment: create or update a pull request comment with the generated report
See all options with:
ghareports --help
GitHub Actions Example
Using the listener directly in a workflow step:
- name: Run Robot Framework tests
run: robot --listener GHAReports tests/
Generating the summary afterward from an existing result file:
- name: Run Robot Framework tests
run: robot tests/
- name: Publish GitHub summary
run: ghareports --robotlog output.xml
pabot Note
Direct listener use inside pabot is intentionally not supported. When PABOTQUEUEINDEX is detected, the listener exits without initializing.
For parallel execution, the expected workflow is:
- Run tests with
pabot - Merge results into a single
output.xml - Run
ghareports --robotlog output.xml
Local Development
Source code lives under src/GHAReports. Tests are in utest/, and the example Robot assets are under example/.
Install development dependencies with your preferred toolchain, then use the repository tasks:
uv sync --locked --all-extras --dev
uv run inv formatcheck
uv run inv ruff
uv run python -m pytest
If you have installed ghareports and the development tools into an already activated virtual environment, you can omit uv run and invoke the commands directly because the executables are already on PATH.
Useful local example commands:
export GITHUB_STEP_SUMMARY=$(pwd)/example_summary.md
uv run inv example
uv run inv examplecilistener
uv run inv examplecicli
invoke example regenerates the sample summary from the demo suites. The examplecilistener and examplecicli tasks are useful when validating the listener and CLI flows locally.
Project Layout
src/GHAReports/GHAReports.py: listener implementation and summary assemblysrc/GHAReports/cli.py: CLI entry point for processingoutput.xmlsrc/GHAReports/mdgen.py: Markdown generation helpersutest/test_all.py: unit testsexample/: Robot Framework demo suites and resources
License
GPLv3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file robotframework_ghareports-1.0.0.tar.gz.
File metadata
- Download URL: robotframework_ghareports-1.0.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ecefac020b39b7a4d91c67e52a29c1f77571fd4502332cf34a0020cce9de9b6
|
|
| MD5 |
2b00e0a8209cb36c06f39592533f01d8
|
|
| BLAKE2b-256 |
004dca3d919508b3b5b7c02d0a63d4917a0d7b44f8ec3feb38b42babfcd5ca91
|
File details
Details for the file robotframework_ghareports-1.0.0-py3-none-any.whl.
File metadata
- Download URL: robotframework_ghareports-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a16d37500799b5ddeb65e3fe3f072161297731c73ddedc0fb9090bc63b5e645a
|
|
| MD5 |
566ec1f540df21d5746d14b9697739c0
|
|
| BLAKE2b-256 |
7a0d538ba5b79ffaad6c83610adb3b3c1f4eacdcd310d46e88e7c1a49929d15c
|