Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ For more information on these inputs, see the [Workflow syntax for GitHub Action
- `artifact-name`: The GitHub artifact name of the generated HTML report. For example, `code-coverage-report`. _Note:_ When downloading, it will be extracted in an `html` directory
- `minimum-coverage`: The minimum coverage to pass the check. Optional. Default: `0` (always passes)
- `github-token`: Set the `${{ secrets.GITHUB_TOKEN }}` token to have the action comment the coverage summary in the pull request. This token is provided by Actions, you do not need to create your own token. Optional. Default: ``
- `project-dir`: [Optional] The custom directory. Use only if your project folder is not in the root folder (e.g. in case your repo contains multiple projects)

### Outputs
None.
Expand All @@ -42,6 +43,8 @@ jobs:
- name: Report code coverage
uses: zgosalvez/github-actions-report-lcov@v1
with:
# Optional: use only if your project not located on root.
# project-dir: apps/my-first-app
coverage-files: coverage/lcov.*.info
minimum-coverage: 90
artifact-name: code-coverage-report
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ name: 'Report LCOV'
description: 'Report the code coverage from LCOV files'
author: 'Zennon Gosalvez'
inputs:
project-dir:
description: 'The custom directory. Use only if your project folder is not in the root folder (e.g. in case your repo contains multiple projects)'
required: false
coverage-files:
description: 'The coverage files to scan. For example, `coverage/lcov.*.info`'
required: true
Expand Down
4 changes: 3 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ async function run() {
const globber = await glob.create(coverageFilesPattern);
const coverageFiles = await globber.glob();

await genhtml(coverageFiles, tmpPath);
const projectDir = core.getInput('project-dir') || '';

await genhtml(coverageFiles, path.resolve(tmpPath, projectDir));

const coverageFile = await mergeCoverages(coverageFiles, tmpPath);
const totalCoverage = lcovTotal(coverageFile);
Expand Down