Skip to content

Code coverage comments

Actions
Comment code coverage from lcov.info or clover.xml file in commits or PRs
v2.2
Latest
Star (1)

A Github action to comment coverage data from a clover.xml or lcov.info file in commits/ PRs.

Features:

  • ☘️ Support clover.xml or lcov.info
  • 💬 Delete old comments to avoid spamming the conversation
  • ✨ Clean, minimal comment
  • 🥳 Emojis

To be developed:

  • Config param to specify coverage comments on commits, PRs, or both
  • Config param to show coverages of changed files only

"An example of how code coverage comment on a commit"

Usage

In your workflow:

jobs:
  your-job:
    runs-on: ubuntu-latest
+    # Require to specify permissions
+    permissions: write-all
    steps:
      - uses: actions/checkout@v3
      - uses: pnpm/action-setup@v2
        with:
          version: 7.30.0
      - run: pnpm install
      - run: pnpm test
+      # This needs to be run after a test job so coverage file will be available.
+      - uses: kcjpop/[email protected]
+        with:
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          coverage-file: './coverage/clover.xml'

Configurations

Parameter Description Mandatory Default value
github-token Yes ${{ github.token }}
coverage-file Path to lcov.info or clover.xml file Yes
working-directory Set working directory if project is not in root folder No './'
delete-old-comments Keep only one coverage comment, to avoid spamming a PR with outdated info No true

Example: lcov.info is in a different folder

- uses: kcjpop/[email protected]
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    coverage-file: 'front/coverage/lcov.info'

Acknowledgements

This codebase is largely based on prior work of romeovs/lcov-reporter-action.

Code coverage comments is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Comment code coverage from lcov.info or clover.xml file in commits or PRs
v2.2
Latest

Code coverage comments is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.