Skip to content

Commit

Permalink
Upload report to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Beal committed May 3, 2024
1 parent 0485d55 commit 8c4cbaf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,24 @@ jobs:
with:
config: ./.testcoverage.yml

- name: Upload report
uses: actions/upload-artifact@v4
id: uploaded-report
with:
name: cover
path: cover.html

- name: Comment test coverage
if: ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v7
env:
TOTAL_COVERAGE: ${{ steps.go-test-coverage.outputs.total-coverage }}
ARTIFACT_URL: ${{ steps.uploaded-report.outputs.artifact-url }}
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Total test coverage: ${{ env.TOTAL_COVERAGE }}%'
body: 'Total test coverage: ${{ env.TOTAL_COVERAGE }}%\n Download report: ${{ env.ARTIFACT_URL }}'
})

0 comments on commit 8c4cbaf

Please sign in to comment.