Update test_npm.yml #46
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: Test Coverage | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo: | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
- run: npm install | |
- run: npm test | |
- name: get specified property | |
id: repository_type | |
uses: zoexx/github-action-json-file-properties@release | |
with: | |
file_path: "test-results/result.json" | |
prop_path: "coverage.percent" | |
- run: | | |
echo ${{steps.repository_type.outputs.value}} | |
- name: Create badge | |
uses: emibcn/badge-action@d6f51ff11b5c3382b3b88689ae2d6db22d9737d1 | |
with: | |
label: Tests | |
status: 'Tests Coverage: ${{steps.repository_type.outputs.value}}%' | |
color: '31c653' | |
path: badge.svg | |
- name: Upload badge to Gist | |
# Upload only for master branch | |
if: github.ref == 'refs/heads/master' | |
uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d | |
with: | |
token: ${{ secrets.GIST_TOKEN }} | |
gistURL: https://gist.github.com/montumodi/4863975b3d11c22536fcf9fcc8d237dd | |
file: badge.svg |