Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.1.0] - 2026-04-29

### Added
- `title` input — optional H2 heading at the top of the PR comment. Useful in monorepos where a matrix of coverage jobs runs and each comment needs to identify which app or package it belongs to. When unset (default), no heading is rendered and behavior is unchanged.

## [2.0.0] - 2026-04-08

### Added
Expand Down
54 changes: 42 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ jobs:
pytest --cov --cov-report=xml

- name: Diff Coverage
uses: Affanmir/diff-cover-action@v1
uses: Affanmir/diff-cover-action@v2
with:
coverage-files: coverage.xml
fail-under: '80'
Expand All @@ -191,7 +191,7 @@ jobs:

```yaml
- name: Diff Quality
uses: Affanmir/diff-cover-action@v1
uses: Affanmir/diff-cover-action@v2
with:
mode: quality
violations: ruff.check
Expand All @@ -202,13 +202,13 @@ jobs:

```yaml
- name: Diff Coverage
uses: Affanmir/diff-cover-action@v1
uses: Affanmir/diff-cover-action@v2
with:
coverage-files: coverage.xml
fail-under: '80'

- name: Diff Quality
uses: Affanmir/diff-cover-action@v1
uses: Affanmir/diff-cover-action@v2
with:
mode: quality
violations: flake8
Expand Down Expand Up @@ -274,6 +274,12 @@ jobs:
| `fail-under` | Minimum acceptable percentage (0-100) | `0` |
| `fail-on-threshold` | Fail the step when below threshold | `true` |

### Comment Customization

| Input | Description | Default |
|-------|-------------|---------|
| `title` | Optional H2 heading shown at the top of the PR comment (e.g. app name in a monorepo). Empty = no heading. | |

### GitHub Integration

| Input | Description | Default |
Expand Down Expand Up @@ -307,7 +313,7 @@ jobs:
```yaml
- name: Diff Coverage
id: coverage
uses: Affanmir/diff-cover-action@v1
uses: Affanmir/diff-cover-action@v2
with:
coverage-files: coverage.xml

Expand Down Expand Up @@ -357,7 +363,7 @@ Enable badge generation and use with shields.io:

```yaml
- name: Diff Coverage
uses: Affanmir/diff-cover-action@v1
uses: Affanmir/diff-cover-action@v2
with:
coverage-files: coverage.xml
create-badge: 'true'
Expand All @@ -376,23 +382,23 @@ Then use with a [shields.io endpoint badge](https://shields.io/badges/endpoint-b
### Multiple Coverage Files

```yaml
- uses: Affanmir/diff-cover-action@v1
- uses: Affanmir/diff-cover-action@v2
with:
coverage-files: 'unit-coverage.xml integration-coverage.xml'
```

### Glob Patterns

```yaml
- uses: Affanmir/diff-cover-action@v1
- uses: Affanmir/diff-cover-action@v2
with:
coverage-files: '**/coverage*.xml'
```

### Exclude Patterns

```yaml
- uses: Affanmir/diff-cover-action@v1
- uses: Affanmir/diff-cover-action@v2
with:
coverage-files: coverage.xml
exclude: |
Expand All @@ -404,7 +410,7 @@ Then use with a [shields.io endpoint badge](https://shields.io/badges/endpoint-b
### JaCoCo (Java)

```yaml
- uses: Affanmir/diff-cover-action@v1
- uses: Affanmir/diff-cover-action@v2
with:
coverage-files: target/site/jacoco/jacoco.xml
src-roots: 'src/main/java'
Expand All @@ -413,7 +419,7 @@ Then use with a [shields.io endpoint badge](https://shields.io/badges/endpoint-b
### TOML Configuration

```yaml
- uses: Affanmir/diff-cover-action@v1
- uses: Affanmir/diff-cover-action@v2
with:
coverage-files: coverage.xml
config-file: pyproject.toml
Expand All @@ -428,14 +434,38 @@ fail_under = 80
exclude = ["tests/*", "setup.py"]
```

### Monorepo Matrix (titled comments per app)

When several coverage jobs run in a matrix, give each comment its own heading and a unique `comment-identifier` so they don't overwrite each other:

```yaml
jobs:
coverage:
strategy:
matrix:
app: [online-store, cms, partners-app]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pnpm test:unit:${{ matrix.app }}
- uses: Affanmir/diff-cover-action@v2
with:
title: ${{ matrix.app }}
coverage-files: apps/${{ matrix.app }}/coverage/lcov.info
comment-identifier: diff-cover-${{ matrix.app }}
fail-under: '80'
```

Each PR gets one comment per app, headed with the app name.

### Conditional Failure

Report coverage without failing the step:

```yaml
- name: Coverage Report
id: coverage
uses: Affanmir/diff-cover-action@v1
uses: Affanmir/diff-cover-action@v2
with:
coverage-files: coverage.xml
fail-under: '80'
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ <h2>Quick Start</h2>
pytest --cov --cov-report=xml

- name: Diff Coverage
uses: Affanmir/diff-cover-action@v1
uses: Affanmir/diff-cover-action@v2
with:
coverage-files: coverage.xml
fail-under: '80'</code></pre>
Expand Down
12 changes: 11 additions & 1 deletion llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,22 @@ Any language that produces Cobertura XML, lcov, or JaCoCo coverage reports: Pyth
## Usage

```yaml
- uses: Affanmir/diff-cover-action@v1
- uses: Affanmir/diff-cover-action@v2
with:
coverage-files: coverage.xml
fail-under: '80'
```

In monorepos with a matrix of coverage jobs, set `title` so each PR comment identifies its app, and a unique `comment-identifier` so comments don't overwrite each other:

```yaml
- uses: Affanmir/diff-cover-action@v2
with:
title: partners-app
coverage-files: apps/partners-app/coverage/lcov.info
comment-identifier: diff-cover-partners-app
```

## Links

- [GitHub Repository](https://github.com/Affanmir/diff-cover-action)
Expand Down
Loading