coverage fix #79
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install and build | |
run: yarn | |
- name: Run Tests | |
run: yarn test >> coverage.txt | |
- name: Extract coverage percentage | |
id: extract_coverage | |
run: | | |
# Extract the "Statements" percentage from the Coverage summary | |
COVERAGE=$(awk '/Statements/ {print $3}' coverage.txt | tr -d '%') | |
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV | |
- name: Create coverage badge | |
run: | | |
curl -X POST -d '{"schemaVersion": 1, "label": "coverage", "message": "'"${{ env.COVERAGE }}"'%'", "color": "brightgreen"}' https://img.shields.io/endpoint > coverage-badge.json | |
- name: Commit coverage badge | |
run: | | |
git config --global user.name 'GitHub Action' | |
git config --global user.email 'action@github.com' | |
mv coverage-badge.json ./coverage.json | |
git add coverage.json | |
git commit -m "Update coverage badge" | |
git push |