summaryrefslogtreecommitdiff
path: root/.github/workflows/coverage.yml
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-12-28 06:42:55 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-12-28 11:24:32 -0500
commitf2822a8903135a441a28510dd5c94bc437eabde4 (patch)
treeee37144093c5411530eb630c1c2cdbc7ed96af25 /.github/workflows/coverage.yml
parentfb5193003b380cc768bbc0035667c4f672ba898d (diff)
downloadpython-coveragepy-git-f2822a8903135a441a28510dd5c94bc437eabde4.tar.gz
build: generate a metacov badge
Diffstat (limited to '.github/workflows/coverage.yml')
-rw-r--r--.github/workflows/coverage.yml18
1 files changed, 17 insertions, 1 deletions
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 0a3fba69..4db18278 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -140,7 +140,7 @@ jobs:
name: json_report
path: coverage.json
- - name: "Create info for pushing to report repo"
+ - name: "Create info for later steps"
id: info
run: |
export SHA10=$(echo ${{ github.sha }} | cut -c 1-10)
@@ -150,6 +150,11 @@ jobs:
echo "::set-output name=slug::$SLUG"
echo "::set-output name=url::https://nedbat.github.io/coverage-reports/reports/$SLUG/htmlcov"
echo "::set-output name=branch::${REF#refs/heads/}"
+ export PCTINT=$(echo ${{ steps.combine.outputs.total }} | cut -f1 -d.)
+ if (($PCTINT >= 85)); then echo "::set-output name=badgecolor::green"; fi
+ if (($PCTINT < 85)); then echo "::set-output name=badgecolor::yellow"; fi
+ if (($PCTINT < 70)); then echo "::set-output name=badgecolor::orange"; fi
+ if (($PCTINT < 60)); then echo "::set-output name=badgecolor::red"; fi
- name: "Push to report repository"
uses: sebastian-palma/github-action-push-to-another-repository@allow-creating-destination-directory
@@ -187,3 +192,14 @@ jobs:
- name: "Show link to report"
run: |
echo "Coverage report: ${{ steps.info.outputs.url }}"
+
+ - name: "Create badge"
+ # https://gist.githubusercontent.com/nedbat/8c6980f77988a327348f9b02bbaf67f5
+ uses: schneegans/dynamic-badges-action@v1.1.0
+ with:
+ auth: ${{ secrets.METACOV_GIST_SECRET }}
+ gistID: 8c6980f77988a327348f9b02bbaf67f5
+ filename: metacov.json
+ label: Coverage
+ message: ${{ steps.combine.outputs.total }}%
+ color: ${{ steps.info.outputs.badgecolor }}