diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 0aa5b22d02..3e26076990 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -76,12 +76,9 @@ jobs: 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_comment.txt - # Set up the comment payload in a JSON file - echo '{"body": "'$(cat coverage_comment.txt | sed ':a;N;$!ba;s/\n/\\n/g')'"}' > comment_payload.json - - # Post the comment using the GitHub API + # 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 @comment_payload.json \ - "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" + -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"