-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (34 loc) · 1.02 KB
/
coverage.yml
File metadata and controls
42 lines (34 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Update Coverage Badge
on:
push:
branches: [ main, master ]
paths:
- 'src/**'
pull_request:
branches: [ main, master ]
jobs:
test-and-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests with coverage
run: npm run coverage
- name: Generate coverage badges
run: npx coverage-badges --source coverage/coverage-summary.json --output coverage/badges.svg
- name: Commit updated badges
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add coverage/badges.svg
git diff --staged --quiet || git commit -m "🤖 Update coverage badges [skip ci]"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}