Skip to content

Merge pull request #9 from fullstacksjs/next #5

Merge pull request #9 from fullstacksjs/next

Merge pull request #9 from fullstacksjs/next #5

Workflow file for this run

name: Coverage Badge
on:
workflow_dispatch:
push:
branches:
- main
paths:
- src/**
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: 'package.json'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Get Coverage
id: get-coverage
shell: bash
run: |
npm run test:coverage
COV=$(node -p 't=require(`./coverage/coverage-summary.json`).total,Math.min(...`lines|statements|functions|branches`.split(`|`).map(k=>t[k].pct))')
echo "coverage=$COV" >> $GITHUB_OUTPUT
- name: Checkout assets
uses: actions/checkout@v3
with:
ref: 'assets'
- name: Create Badge
shell: bash
run: |
npm i -g badgen-cli
export COV=${{ steps.get-coverage.outputs.coverage }}
badgen -j coverage --status $COV% --flat --color 319663 > assets/coverage.svg
- name: Deploy Badge
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'ci: update coverage badge'
skip_fetch: true
skip_checkout: true
commit_options: '--no-verify'
push_options: '--no-verify'