Skip to content

Commit

Permalink
ci: switch coverage badge to dedicated job
Browse files Browse the repository at this point in the history
  • Loading branch information
samypr100 committed Dec 18, 2023
1 parent 02f80b0 commit 9bca92e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,21 @@ jobs:
- name: Output Coverage
run: echo "COVERAGE_JSON=$(jq -c . < coverage.json)" >> $GITHUB_ENV
- name: Get Coverage Totals
run: echo "COVERAGE_TOTAL=${{ fromJson(env.COVERAGE_JSON).totals.percent_covered_display }}" >> $GITHUB_ENV
id: coverage-total
run: echo "coverage_total=${{ fromJson(env.COVERAGE_JSON).totals.percent_covered_display }}" >> $GITHUB_OUTPUT
outputs:
coverage_total: ${{ steps.coverage-total.outputs.coverage_total }}

coverage-badge:
runs-on: ubuntu-latest
needs:
- coverage
if: github.ref == 'refs/heads/main'
environment: release
env:
COVERAGE_TOTAL: ${{ needs.coverage.outputs.coverage_total }}
steps:
- name: Create Coverage Badge
if: github.ref == 'refs/heads/main'
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_TOKEN }}
Expand Down

0 comments on commit 9bca92e

Please sign in to comment.