Skip to content

Commit

Permalink
Update coverage comment
Browse files Browse the repository at this point in the history
* Add info even if test failed
* Print minimum required coverage
  • Loading branch information
file-sync-app[bot] committed Jan 14, 2024
1 parent 975c92f commit e53dc61
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/workflows/coverage-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ on:

jobs:
comment:
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event.workflow_run.event == 'pull_request' }}
name: 'Comment Code Coverage'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: 'Download artifacts'
uses: actions/github-script@v7.0.1
with:
Expand Down Expand Up @@ -44,6 +46,13 @@ jobs:
pr-number: ${{ env.pr_number }}
hide-branch-coverage: true
output-file: comment.html
- name: 'Prepend minimum coverage required'
run: |
echo -e "Minimum coverage required: <b>$(cat ./.github/minimum_coverage.txt)%</b>\n<br />\n$(cat comment.html)" > comment.html
- name: 'Prepand failure info'
if: ${{ github.event.workflow_run.conclusion != 'success' }}
run: |
echo -e "❌ <b>Minimum coverage check failed!</b>\n<br />\n$(cat comment.html)" > comment.html
- name: Post code coverage report
uses: marocchino/sticky-pull-request-comment@v2.8.0
with:
Expand Down

0 comments on commit e53dc61

Please sign in to comment.