Skip to content

Merge pull request #1742 from terrestris/update-unittests #117

Merge pull request #1742 from terrestris/update-unittests

Merge pull request #1742 from terrestris/update-unittests #117

name: Update Coverage in README
on:
push:
branches:
- main
jobs:
update-coverage-in-readme:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Install dependencies ⏬
run: npm ci
- name: Run tests ✅
run: npm run test
- name: Jest Coverage Comment 💬
if: github.ref == 'refs/heads/main'
id: coverageComment
uses: MishaKav/jest-coverage-comment@main
with:
hide-summary: true
coverage-summary-path: ./coverage/all/coverage-summary.json
- name: Update README with Coverage HTML 📄
if: github.ref == 'refs/heads/main'
run: |
sed -i "/<!-- Jest Coverage Comment:Begin -->/,/<!-- Jest Coverage Comment:End -->/c\<!-- Jest Coverage Comment:Begin -->\n${{ steps.coverageComment.outputs.summaryHtml }}\n<!-- Jest Coverage Comment:End -->" ./README.md
- name: Commit & Push changes in README 🚩
if: github.ref == 'refs/heads/main'
uses: actions-js/push@master
with:
message: Update coverage in README
github_token: ${{ secrets.GITHUB_TOKEN }}