From 4da09a9b78d0dcc97055f25bdb630c9c3777da76 Mon Sep 17 00:00:00 2001 From: "file-sync-app[bot]" <89714990+file-sync-app[bot]@users.noreply.github.com> Date: Sun, 14 Jan 2024 01:18:53 +0000 Subject: [PATCH] Update coverage comment * Add info even if test failed * Print minimum required coverage --- .github/workflows/coverage-comment.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coverage-comment.yml b/.github/workflows/coverage-comment.yml index a89ccc9..5351d7e 100644 --- a/.github/workflows/coverage-comment.yml +++ b/.github/workflows/coverage-comment.yml @@ -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: @@ -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: $(cat ./.github/minimum_coverage.txt)%\n
\n$(cat comment.html)" > comment.html + - name: 'Prepand failure info' + if: ${{ github.event.workflow_run.conclusion != 'success' }} + run: | + echo -e "❌ Minimum coverage check failed!\n
\n$(cat comment.html)" > comment.html - name: Post code coverage report uses: marocchino/sticky-pull-request-comment@v2.8.0 with: