Skip to main content

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:

java comment screenshot

Supported 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.

  1. Set up Stoat with our getting started guide.

  2. 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()
  3. 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-report

    By default, npm run jest --coverage will generate a HTML report in the coverage/lcov-report directory (documentation here). This is the directory to set for the path 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.

  4. 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.

    jest comment screenshot