Skip to content

ci: fix code coverage badge generation #327

ci: fix code coverage badge generation

ci: fix code coverage badge generation #327

name: Generate CodeCoverage Badge
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: "18"
cache: "npm"
- name: Install dependencies
run: npm install
- name: Run unit tests with coverage
run: |
npm run coverage
STATEMENTS=cat coverage/coverage-summary.json | jq -r '.total.statements.pct'
echo "COVERAGE=$(echo \"${STATEMENTS}%\")" >> $GITHUB_ENV
- name: Create Coverage Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 51a8c6c4f125bd6ec25a14a6f12e28bc
filename: vue-timeago3_coverage.json
label: Test Coverage
message: ${{ env.COVERAGE }}
namedLogo: jest
color: brightgreen