ci: fix code coverage badge generation #323
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: 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 | |
cat coverage/coverage-summary.json | jq -r '.total.statements.pct' >> $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 |