View reports in pull requests
Stoat can help you view HTML build reports generated as part of your build in a comment on your pull request.
Here's an example of a Stoat comment that links to various Java build reports generated by the latest build:

Supported Reports
- Test results (JUnit, Jest, Mocha, pytest-html, etc.)
- Test coverage (JaCoCo, coverage.py, etc.)
- Static analysis (Checkstyle, PMD violations, etc.)
- API Docs (Swagger, ReDoc, etc.)
- Code Docs (Javadoc, pydoc, pdoc, etc.)
- ...and any other static HTML reports!
Example Repo
See a real build that generates various Java reports links them in a Stoat comment in this pull request.
Adding static reports to the Stoat comment
In this tutorial we will show how to add a Jest test coverage report to the Stoat comment, but the same approach applies for any static HTML report produced by your build.
Set up Stoat with our getting started guide.
Make sure the Stoat Action appears after the GitHub workflow step that generates your Jest HTML test coverage report.
.github/workflows/docs.yaml# existing step in your repo that runs Jest
- name: Run Tests
run: |
npm install
npm run jest --coverage
- name: Run Stoat Action
uses: stoat-dev/stoat-action@v0
if: always()Point Stoat at the generated Jest HTML test coverage report by adding a new task that uses the
static_hosting
plugin:.stoat/config.yaml---
version: 1
enabled: true
plugins:
static_hosting:
jest:
metadata:
# a name for the Jest task
name: "Jest Coverage"
# path to the Jest coverage report
path: coverage/lcov-reportBy default,
npm run jest --coverage
will generate a HTML report in thecoverage/lcov-report
directory (documentation here). This is the directory to set for thepath
field in the Stoat config file. If Jest is built in a subdirectory of the Git repository or if you're using a different tool to generate an HTML report, the path will be different.That's it! Now, every time you open a pull request, Stoat will host the Jest report and post a comment with a link to view it. See an example in this pull request.