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 07:47:20 -0500
commit0afe5ee76094b4482867070792f0bf4c400f9165 (patch)
tree7e748c2c56030c452890306277c1201e1ba2c132 /.github/workflows/coverage.yml
parent9a085ef3aa734f1a29f81444eea177b019fa7cf5 (diff)
downloadpython-coveragepy-git-0afe5ee76094b4482867070792f0bf4c400f9165.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 12070d26..23ac2f0f 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 }}