22
33name : CI
44
5- # Controls when the action will run.
65on : [push, pull_request]
76
8- # A workflow run is made up of one or more jobs that can run sequentially or in parallel
7+ env :
8+ TARGET_COVERAGE_NODE_VERSION : ' 20'
9+
910jobs :
10- # This workflow contains a single job called "build"
11- test :
12- # The type of runner that the job will run on
11+ report-coverage :
1312 runs-on : ubuntu-latest
13+ permissions :
14+ pull-requests : write
1415 strategy :
1516 matrix :
1617 node_version :
@@ -34,24 +35,16 @@ jobs:
3435 # with:
3536 # path: '**/checkstyle-result.xml'
3637 - name : Coverage
38+ if : matrix.node_version == env.TARGET_COVERAGE_NODE_VERSION
3739 run : npm run coverage
38- # Required for generating html artifact, can be skipped if not generating html artifact
39- # - name: Report coverage
40- # uses: hrishikesh-kadam/setup-lcov@v1
41- # - name: Upload coverage report
42- # uses: kefasjw/lcov-pull-request-report@v1
43- # with:
44- # # Lcov file location. For example, coverage/lcov.info
45- # lcov-file: coverage/lcov.info
46-
47- # # Github token required for getting list of changed files and posting comments
48- # github-token: ${{ secrets.GITHUB_TOKEN }}
49- # ... Generate LCOV files or download it from a different job
50- # - name: Setup LCOV
51- # uses: hrishikesh-kadam/setup-lcov@v1
52- # - name: Report coverage
53- # uses: zgosalvez/github-actions-report-lcov@v4
54- # with:
55- # coverage-files: coverage/lcov.info
56- # github-token: ${{ secrets.ACTIONS_TOKEN }}
57- # update-comment: true
40+ - name : Setup LCOV
41+ if : matrix.node_version == env.TARGET_COVERAGE_NODE_VERSION
42+ uses : hrishikesh-kadam/setup-lcov@v1
43+ - name : Report code coverage
44+ if : matrix.node_version == env.TARGET_COVERAGE_NODE_VERSION
45+ uses : zgosalvez/github-actions-report-lcov@v4
46+ with :
47+ coverage-files : coverage/lcov.info
48+ artifact-name : code-coverage-report
49+ github-token : ${{ secrets.GITHUB_TOKEN }}
50+ update-comment : true
0 commit comments