Skip to content

Commit

Permalink
still experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnuchalla committed Jul 7, 2023
1 parent e31238a commit 8b0682a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/go-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,19 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.out
flag: unittests
flag: unittests
- name: Generate Coverage Comment
id: generate-comment
run: |
COVERAGE_PERCENT=$(go tool cover -func=coverage.out | grep total | awk '{print $NF}')
COMMENT_MESSAGE="Code coverage: $COVERAGE_PERCENT%"
echo "::set-output name=comment::$COMMENT_MESSAGE"
- name: Comment on Pull Request
run: |
COMMENT_BODY="${{ steps.generate-comment.outputs.comment }}"
curl \
-X POST \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"body\":\"$COMMENT_BODY\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"

0 comments on commit 8b0682a

Please sign in to comment.