Skip to content

kcjpop/coverage-comments

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

kcjpop/coverage-comments@v2.2

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/coverage-comments@v2.2
+        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/coverage-comments@v2.2
  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.

About

Comment coverage data from a clover.xml or lcov.info file in commits/ PRs

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published