Skip to content

Commit eedf888

Browse files
Update CI/CD
1 parent 067c20c commit eedf888

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/main.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,26 @@ jobs:
2626

2727
- name: Run tests
2828
run: npm run test:handler
29+
30+
- name: Install jq
31+
run: sudo apt-get install jq
32+
33+
- name: Generate coverage badge
34+
run: |
35+
COVERAGE=$(cat coverage/coverage-summary.json | jq '.total.lines.pct')
36+
echo "![Coverage](https://img.shields.io/badge/coverage-${COVERAGE}%25-brightgreen)" > coverage/coverage_badge.md
37+
38+
- name: Update README with coverage badge
39+
run: |
40+
BADGE_CONTENT=$(cat coverage/coverage_badge.md)
41+
sed -i "s|!\[Coverage\](.*)|${BADGE_CONTENT}|" README.md
42+
43+
- name: Commit and push changes
44+
run: |
45+
git config --local user.email "${{ secrets.GIT_USER_EMAIL }}"
46+
git config --local user.name "${{ secrets.GIT_USER_NAME }}"
47+
git add README.md
48+
git commit -m "Update coverage badge"
49+
git push
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)