Official GitHub Action for trep. Generates HTML test and coverage reports, uploads them as workflow artifacts, and writes a Markdown summary to the Actions Job Summary page.
- Multi-format test input: JUnit XML, Google Test XML,
go test -json, TAP, NUnit, Cucumber JSON - Multi-format coverage input: LCOV, Go coverprofile, Cobertura, Clover
- Job Summary written automatically on every run
- Report uploaded as a workflow artifact
- Inline PR annotations for failures and low-coverage files
- Coverage thresholds with optional
failbehaviour - Delta badges compared against a baseline snapshot
- Cross-platform: Ubuntu, macOS, and Windows runners
steps:
- uses: actions/checkout@v4
- run: go test -json ./... > results.json
- uses: trep-dev/action@v1
with:
tests: results.json - uses: trep-dev/action@v1
with:
command: cov
coverage: coverage.out
threshold-line: '80'
fail: 'true' - uses: trep-dev/action@v1
with:
command: report
tests: results.xml
coverage: coverage.out
title: 'My Project'
threshold-line: '75'
fail: 'true'Compare against a baseline to show coverage changes in PR comments and badge deltas.
jobs:
test:
steps:
# Restore the baseline snapshot saved from the main branch.
- uses: actions/cache/restore@v4
with:
path: trep-snapshot.json
key: trep-snapshot-main
- run: go test -coverprofile=coverage.out ./...
- uses: trep-dev/action@v1
with:
command: cov
coverage: coverage.out
baseline: trep-snapshot.json # compare against main
baseline-label: main
save-snapshot: trep-snapshot-pr.json # save this run's snapshot
# On pushes to main, update the cached baseline.
- if: github.ref == 'refs/heads/main'
uses: actions/cache/save@v4
with:
path: trep-snapshot-pr.json
key: trep-snapshot-main - uses: trep-dev/action@v1
id: trep
with:
tests: results.xml
- run: |
echo "passed=${{ steps.trep.outputs.passed }}"
echo "failed=${{ steps.trep.outputs.failed }}"trep writes the report to a path derived from the first input file. If the
input path contains no file extension the output path may not match what the
action expects. Provide an explicit relative path such as results.xml rather
than an absolute path or glob pattern so the output resolves correctly.
The total, passed, failed, and skipped outputs are populated from a
temporary JSON stats file written by trep. If the action prints
::warning::trep stats unavailable the trep invocation likely failed silently.
Enable debug logging (ACTIONS_STEP_DEBUG=true) or set fail: 'true' so
errors surface immediately.
Set fail: 'true' and specify at least one threshold (threshold-line,
threshold-branch, or threshold-func). Without both, trep exits 0
regardless of coverage levels.
The upload-artifact step requires contents: read plus actions: write
permissions. Forks that open PRs into your repo run with reduced permissions.
Set upload-artifact: 'false' in workflows triggered by
pull_request events from forks, or use pull_request_target with caution.
| Input | Default | Description |
|---|---|---|
command |
test |
Sub-command: test, cov, or report |
tests |
Test result files (one per line). Required for test and report |
|
coverage |
Coverage files (one per line). Required for cov and report |
|
format |
auto | Force input format (see trep docs for valid values) |
output-format |
html |
Output format for test/cov: html, json, sarif, markdown |
title |
Report title | |
fail |
false |
Exit non-zero on test failures or threshold breaches |
annotate |
true |
Emit GitHub PR annotations |
threshold-line |
0 |
Minimum line coverage % (cov and report only; 0 = disabled) |
threshold-branch |
0 |
Minimum branch coverage % (cov only; 0 = disabled) |
threshold-func |
0 |
Minimum function coverage % (cov only; 0 = disabled) |
upload-artifact |
true |
Upload the report as a workflow artifact |
artifact-name |
trep-report |
Artifact name |
artifact-retention-days |
30 |
Artifact retention in days |
summary |
true |
Write Markdown summary to the Job Summary page |
baseline |
Path to a previous snapshot JSON for delta badges | |
baseline-label |
Label for the baseline (e.g. main) |
|
save-snapshot |
Path to save the current run snapshot | |
strip-prefix |
Path prefix to strip from coverage file paths | |
exclude |
Glob patterns to exclude from coverage (one per line) | |
version |
latest |
trep version to install, e.g. v0.2.0 |
| Output | Description |
|---|---|
report-path |
Absolute path to the primary generated report file |
total |
Total number of test cases |
passed |
Number of passed test cases |
failed |
Number of failed test cases |
skipped |
Number of skipped test cases |
coverage-pct |
Aggregate line coverage percentage |