Skip to content

Commit 7114601

Browse files
committed
Comment coverage on PR
1 parent c0a807b commit 7114601

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

.github/workflows/unit-test.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,22 @@ jobs:
3535
3636
- name: 🧪 Run tests with coverage
3737
run: |
38-
poetry run pytest --cov=pytest_reporter_plus tests/unit/ --cov-fail-under=17
38+
poetry run pytest --cov=pytest_reporter_plus tests/unit/ --cov-fail-under=21 --cov-report=term --cov-report=xml
39+
40+
- name: 📊 Extract coverage percentage
41+
if: github.event_name == 'pull_request'
42+
run: |
43+
COVERAGE=$(coverage report | grep TOTAL | awk '{print $4}')
44+
echo "Coverage is $COVERAGE"
45+
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV
46+
47+
- name: 💬 Comment coverage on PR
48+
if: github.event_name == 'pull_request'
49+
uses: marocchino/sticky-pull-request-comment@v2
50+
with:
51+
message: |
52+
🧪 **Test Coverage**
53+
```
54+
${{ env.COVERAGE }}
55+
```
56+

0 commit comments

Comments
 (0)