Skip to content

Commit

Permalink
Trying to add the redable coverage report in the comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Sachinbisht27 committed Sep 13, 2023
1 parent 17dfef4 commit 9d43f92
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/unit-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,21 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3

- name: Install jq
run: |
sudo apt-get update
sudo apt-get install jq -y
- name: Post Code Coverage Comment
run: |
echo "Code Coverage Report" > coverage_comment.txt
echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt
echo "Coverage details are available below:" >> coverage_comment.txt
cat coverage_report.txt >> coverage_comment.txt
formatted_comment=$(cat coverage_comment.txt)
formatted_comment=$(cat coverage_comment.txt | jq -Rs '.')
echo "Coverage details are available below:" >> $formatted_comment
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
Expand Down

0 comments on commit 9d43f92

Please sign in to comment.