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
2 changes: 2 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: ``
- `working-directory`: The working directory containing the source files referenced in the LCOV files. Optional. Default: `./`

### Outputs
None.
Expand Down Expand Up @@ -46,6 +47,7 @@ jobs:
minimum-coverage: 90
artifact-name: code-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}
working-directory: apps/my-first-app
```

### Flutter Workflows
Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ inputs:
default: 0
github-token:
description: 'Set the GitHub 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: ``'
working-directory:
description: 'The working directory containing the source files referenced in the LCOV files. Optional. Default: `./`'
runs:
using: 'node12'
main: 'dist/main/index.js'
Expand Down
3 changes: 2 additions & 1 deletion dist/main/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/main/index.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ async function run() {
}

async function genhtml(coverageFiles, tmpPath) {
const workingDirectory = core.getInput('working-directory').trim() || './';
const artifactName = core.getInput('artifact-name').trim();
const artifactPath = path.resolve(tmpPath, 'html').trim();
const args = [...coverageFiles];

args.push('--output-directory');
args.push(artifactPath);

await exec.exec('genhtml', args);
await exec.exec('genhtml', args, { cwd: workingDirectory });

const globber = await glob.create(`${artifactPath}/**`);
const htmlFiles = await globber.glob();
Expand Down