@@ -108,39 +108,30 @@ Example of report is in [this PR](https://github.com/vladopajic/go-test-coverage
108108 continue-on-error : true # Should fail after coverage comment is posted
109109 with :
110110 config : ./.github/.testcoverage.yml
111-
112- # Post coverage report as comment (in 3 steps)
111+
112+ # Post coverage report as comment (in 2 steps)
113113 - name : find pull request ID
114114 run : |
115115 PR_DATA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
116- "https://api.github.com/repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${{ github.ref_name }}&state=open")
116+ "https://api.github.com/repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${{ github.ref_name }}&state=open")
117117 PR_ID=$(echo "$PR_DATA" | jq -r '.[0].number')
118118
119119 if [ "$PR_ID" != "null" ]; then
120- echo "pull_request_id=$PR_ID" >> $GITHUB_ENV
120+ echo "pull_request_id=$PR_ID" >> $GITHUB_ENV
121121 else
122- echo "No open pull request found for this branch."
122+ echo "No open pull request found for this branch."
123123 fi
124- - name : find if coverage report is already present
125- if : env.pull_request_id
126- uses : peter-evans/find-comment@v3
127- id : fc
128- with :
129- issue-number : ${{ env.pull_request_id }}
130- comment-author : ' github-actions[bot]'
131- body-includes : ' go-test-coverage report:'
132124 - name : post coverage report
133125 if : env.pull_request_id
134- uses : peter-evans/create-or-update-comment@v4
126+ uses : thollander/actions-comment-pull-request@v3
135127 with :
136- token : ${{ secrets.GITHUB_TOKEN }}
137- issue-number : ${{ env.pull_request_id }}
138- comment-id : ${{ steps.fc.outputs.comment-id }}
139- edit-mode : replace
140- body : |
128+ github-token : ${{ secrets.GITHUB_TOKEN }}
129+ comment-tag : coverage-report
130+ pr-number : ${{ env.pull_request_id }}
131+ message : |
141132 go-test-coverage report:
142133 ```
143- ${{ fromJSON(steps.coverage.outputs.report) }} ```
134+ ${{ fromJSON(steps.coverage.outputs.report) }}```
144135
145136 - name : " finally check coverage"
146137 if : steps.coverage.outcome == 'failure'
0 commit comments