File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -146,15 +146,18 @@ jobs:
146146 - name : Extract coverage percentage
147147 id : coverage
148148 run : |
149- COVERAGE=$(grep "TOTAL" coverage_report.txt | awk '{print $4}' | sed 's/%//')
149+ COVERAGE=$(grep "TOTAL" coverage_report.txt | awk '{print $4}' | sed 's/%//' | head -1)
150+ echo "Coverage: $COVERAGE%"
150151 echo "percentage=$COVERAGE" >> $GITHUB_OUTPUT
151152
152153 - name : Create coverage badge
153- uses : schneegans/dynamic-badges-action@v1.7.0
154- with :
155- auth : ${{ secrets.GITHUB_TOKEN }}
156- gistID : ${{ vars.COVERAGE_GIST_ID }} # Set this in repository variables
157- filename : docutools-coverage.json
158- label : Coverage
159- message : ${{ steps.coverage.outputs.percentage }}%
160- color : ${{ steps.coverage.outputs.percentage > 80 && 'green' || steps.coverage.outputs.percentage > 60 && 'yellow' || 'red' }}
154+ run : |
155+ COVERAGE=$(grep "TOTAL" coverage_report.txt | awk '{print $4}' | sed 's/%//' | head -1)
156+ echo "Coverage: $COVERAGE%"
157+ COLOR="red"
158+ if (( $(echo "$COVERAGE > 80" | bc -l) )); then COLOR="brightgreen"; fi
159+ if (( $(echo "$COVERAGE > 60 && $COVERAGE <= 80" | bc -l) )); then COLOR="yellow"; fi
160+
161+ # Create a simple coverage badge URL for README
162+ echo "Add this to your README:"
163+ echo "[](https://github.com/axiros/docutools/actions/workflows/ci.yml)"
Original file line number Diff line number Diff line change 88[ gh-ci ] : https://github.com/axiros/docutools/actions/workflows/ci.yml
99[ gh-ci_img ] : https://github.com/axiros/docutools/actions/workflows/ci.yml/badge.svg
1010[ coverage ] : https://github.com/axiros/docutools/actions/workflows/ci.yml
11- [ coverage_img ] : https://img.shields.io/endpoint? url=https://gist .githubusercontent.com/YOUR_USERNAME/YOUR_GIST_ID/raw/docutools-coverage.json
11+ [ coverage_img ] : https://img.shields.io/badge/dynamic/xml?color=brightgreen&label=coverage&query=%2F%2F%40line-rate&suffix=%25& url=https%3A%2F%2Fraw .githubusercontent.com%2Faxiros%2Fdocutools%2Fmain%2Fcoverage.xml
1212[ pkg ] : https://pypi.org/project/docutools/2022.04.11/
1313[ pkg_img ] : https://axiros.github.io/docutools/img/badge_pypi.svg
1414[ code_style ] : https://github.com/astral-sh/ruff
You can’t perform that action at this time.
0 commit comments