Skip to content

Commit

Permalink
Show backend coverage as PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
thomass-dev committed Sep 26, 2024
1 parent 0cf8b93 commit 5ee25d0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:

permissions:
contents: read
pull-requests: write

jobs:
lint-backend:
Expand Down Expand Up @@ -49,4 +50,18 @@ jobs:
python -m pip install -r requirements.txt -r requirements-test.txt
- name: Pytest
timeout-minutes: 5
run: python -m pytest
run: python -m pytest --cov-report term > report.txt
- name: Coverage
shell: bash
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${REPOSITORY_OWNER}/${REPOSITORY_NAME}/issues/${PULL_REQUEST_NUMBER}/comments \
-f "body=`cat report.txt`"
env:
GH_TOKEN: ${{ github.token }}
REPOSITORY_OWNER: ${{ github.repository_owner }}
REPOSITORY_NAME: ${{ github.event.repository.name }}
PULL_REQUEST_NUMBER: ${{ github.event.number }}

0 comments on commit 5ee25d0

Please sign in to comment.