From 9d43f92073d8a2ae10e2cd5263073191c279fb9c Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 01:32:54 +0530 Subject: [PATCH] Trying to add the redable coverage report in the comment --- .github/workflows/unit-testing.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index fe278ecb02..6bd9b5f634 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -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" \