From 97ee34b1d309313fc59d4a15dcdbacabf4b0fe18 Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 00:55:38 +0530 Subject: [PATCH] Trying to add the redable coverage report in the comment --- .github/workflows/unit-testing.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 352f638c9b..1d5dab73f2 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -77,11 +77,13 @@ jobs: 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 [here](./coverage.xml)." >> coverage_report.txt + echo "Coverage details are available below:" >> coverage_comment.txt + + cat coverage_report.txt >> coverage_comment.txt # Post the comment using the GitHub API with PR number directly curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ - -d "{\"body\": \"$(cat coverage_report.txt | sed ':a;N;$!ba;s/\n/\\n/g')\"}" \ + -d "{\"body\": \"$(cat coverage_comment.txt | sed ':a;N;$!ba;s/\n/\\n/g')\"}" \ "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ github.event.pull_request.number }}/comments"