File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -146,15 +146,18 @@ jobs:
146
146
- name : Extract coverage percentage
147
147
id : coverage
148
148
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%"
150
151
echo "percentage=$COVERAGE" >> $GITHUB_OUTPUT
151
152
152
153
- 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 8
8
[ gh-ci ] : https://github.com/axiros/docutools/actions/workflows/ci.yml
9
9
[ gh-ci_img ] : https://github.com/axiros/docutools/actions/workflows/ci.yml/badge.svg
10
10
[ 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
12
12
[ pkg ] : https://pypi.org/project/docutools/2022.04.11/
13
13
[ pkg_img ] : https://axiros.github.io/docutools/img/badge_pypi.svg
14
14
[ code_style ] : https://github.com/astral-sh/ruff
You can’t perform that action at this time.
0 commit comments