Github action that publishes the Kover code coverage report as a comment in pull requests https://github.com/marketplace/actions/kotlinx-kover-report
  • TypeScript 99.8%
  • JavaScript 0.2%
Find a file
2026-06-03 09:16:39 +02:00
.github Adjust permissions in the test & build action 2026-05-05 13:07:33 +02:00
.husky Update deps (#316) 2026-04-08 11:37:19 +02:00
dist Bump @actions/core from 2.0.3 to 3.0.1 (#325) 2026-05-05 13:49:09 +02:00
src Bump @actions/core from 2.0.3 to 3.0.1 (#325) 2026-05-05 13:49:09 +02:00
tests Release cleanup 2026-04-29 12:26:35 +02:00
.gitattributes Initial commit 2022-08-10 10:17:31 +02:00
.gitignore Add agents instructions 2026-04-24 09:57:16 +02:00
.node-version Finalize upgrade to node version 24 (#312) 2026-04-08 09:34:18 +02:00
action-types.yml Add optional coverage report upload (#324) 2026-04-28 16:02:25 +02:00
action.yml Add optional coverage report upload (#324) 2026-04-28 16:02:25 +02:00
AGENTS.md Add agents instructions 2026-04-24 09:57:16 +02:00
biome.json Update biome schema 2026-06-03 09:16:39 +02:00
CODE_OF_CONDUCT.md Create code of contuct 2022-11-14 10:04:04 +01:00
LICENSE Initial commit 2022-08-10 10:17:31 +02:00
package.json Bump js-yaml from 4.1.1 to 4.2.0 (#330) 2026-06-03 09:14:53 +02:00
README.md Fix upload url handling 2026-04-28 16:07:10 +02:00
screenshot.png Add title to comment 2022-08-17 09:15:00 +02:00
tsconfig.json Bump @actions/core from 2.0.3 to 3.0.1 (#325) 2026-05-05 13:49:09 +02:00
vitest.config.js Switch to vitest (#317) 2026-04-08 11:39:27 +02:00
yarn.lock Bump js-yaml from 4.1.1 to 4.2.0 (#330) 2026-06-03 09:14:53 +02:00

kover-report

Tests GitHub License Contributor Covenant

A Github action that publishes the Kover code coverage report as a comment in pull requests. The comment shows overall project coverage and per-file coverage for files changed in the compared commit range.

Usage

Pre-requisites

Create a workflow .yml file in your repositories .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.

Inputs

  • path - [required string[]] List of paths or glob patterns to the generated kover report xml files
  • token - [optional string] GitHub personal token to add commits to the pull request
  • title - [optional string] Title for the pull request comment
  • update-comment - [optional boolean (default: false)] Update the coverage report comment instead of creating a new one. Requires title to be set.
  • min-coverage-overall - [optional integer] The minimum code coverage that is required to pass for overall project
  • min-coverage-changed-files - [optional integer] The minimum code coverage that is required to pass for changed files
  • coverage-counter-type - [optional string (default: LINE)] Report counter type used to calculate coverage metrics. Possible values are: INSTRUCTION, LINE or BRANCH.
  • upload_url - [optional string] Full URL of the upload service endpoint that receives coverage XML reports. Must be set together with upload_token.
  • upload_token - [optional string] Bearer token used to authenticate coverage XML report uploads. Must be set together with upload_url.

Outputs

  • coverage-overall - [integer] The overall coverage of the project
  • coverage-changed-files - [integer] The total coverage of all changed files

Example Workflow

name: Measure coverage

on:
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - uses: actions/checkout@v6
      - name: Set up JDK
        uses: actions/setup-java@v5
        with:
          distribution: 'temurin'
          java-version: '21'
      - name: Set up Gradle
        uses: gradle/actions/setup-gradle@v6
      - name: Generate kover coverage report
        run: ./gradlew koverXmlReport

      - name: Add coverage report to PR
        id: kover
        uses: mi-kas/kover-report@v2
        with:
          path: |
            ${{ github.workspace }}/project1/build/reports/kover/report.xml
            ${{ github.workspace }}/project2/build/reports/kover/report.xml
          title: Code Coverage
          update-comment: true
          min-coverage-overall: 80
          min-coverage-changed-files: 80
          coverage-counter-type: LINE
          upload_url: https://coverage.example.com/api/v1/reports/upload
          upload_token: ${{ secrets.COVERAGE_UPLOAD_TOKEN }}

Glob patterns are also supported for path, for example:

          path: |
            ${{ github.workspace }}/**/reports/kover/report.xml

Each path entry is resolved independently. If a glob matches multiple XML files, all of them are included in the report. If an entry does not match anything, it is still treated as a literal path so the action keeps the existing missing-file behavior instead of silently skipping it.

When both upload_url and upload_token are provided, each resolved XML report is also uploaded with a multipart POST request directly to upload_url. The request includes repository, branch, commit SHA, commit timestamp, commit author, commit subject, and the XML file.


output screenshot

Limitations

The pull request comment does not render every class or source file from the XML report. It only lists coverage for files detected as changed between the compared commits, alongside the total project coverage row.

GitHub restricts the maximum permissions to read-only for personal access tokens for pull requests originating from a public forked repository (read more here). This prevents the default configuration of this action from successfully posting the report as a PR comment when using it on public repositories with limited permissions for users to create branches and therefore requiring them to create pull requests from forks.

Code of Conduct

Please read the full Code of Conduct so that you can understand what we expect project participants to adhere to and what actions will and will not be tolerated.

License

The scripts and documentation in this project are released under the MIT License.