Skip to content

Commit 7d67c38

Browse files
committed
ci: Fix posting coverage comments
1 parent e004ae4 commit 7d67c38

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.github/workflows/test_rust.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,21 @@ jobs:
271271
if: always()
272272
run: cat target/diff-cover/report.md >> $GITHUB_STEP_SUMMARY
273273

274-
- name: Comment
274+
- name: Generate comment
275+
id: generate_comment
275276
if: always()
276277
env:
277-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
278278
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
279279
run: |
280-
$COVERAGE_SCRIPT comment_report "target/diff-cover/report.json" "${{ github.event.pull_request.number }}" "${RUN_URL}"
280+
comment=$($COVERAGE_SCRIPT comment_report "target/diff-cover/report.json" "" "${RUN_URL}")
281+
echo "comment=$comment" >> $GITHUB_OUTPUT
282+
283+
- name: Post comment
284+
if: always() && steps.generate_comment.outputs.comment != ''
285+
uses: thollander/actions-comment-pull-request@v3
286+
with:
287+
message: ${{ steps.generate_comment.outputs.comment }}
288+
comment-tag: coverage-report
281289

282290
dependencies:
283291
needs: changes

0 commit comments

Comments
 (0)