Skip to content

ab-git-actions/code-coverage-reporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PR Coverage & Test Reporter

🛡️ A GitHub Action that automatically comments on pull requests with:

  • Code coverage percentage (from coverage.xml)
  • Test summary (from junit.xml)
  • GitHub-native markdown (collapsible details, emojis, badge)

This action is ideal for Python/pytest projects using GitHub Actions for CI/CD.


📦 Features

  • 📊 Coverage badge via shields.io
  • 📦 Summarized test result table with failures, skips, and runtime
  • 🧪 Supports any testing framework that outputs JUnit XML
  • 💬 Posts directly to pull request as a GitHub comment
  • 🧩 Composite action written in Python using gh-actions-tool-kit
  • 💥 Fails gracefully if coverage or JUnit files are missing

🚀 Usage

1. In Your Workflow

on:
  pull_request:
      types: [opened, synchronize, reopened]
  workflow_dispatch: # Allow manual triggers


name: Run Unit Tests
jobs:
  sonarqube:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v5
      with:
        fetch-depth: 0

    - name: Setup Env and Run tests
      run: |
        make setup-env
        make run-pytest

    - name: Comment PR with Coverage and Test Report
      if: github.event_name == 'pull_request'
      uses: ab-git-actions/code-coverage-reporter@v1.0.0
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}
        coverage-file: 'coverage.xml'
        junit-file: 'junit.xml'

About

Report Code Coverage on Pull Request

Resources

License

Stars

Watchers

Forks

Packages

No packages published