Skip to content

Commit 26957ab

Browse files
added custom directory (#1) (#5)
* added custom directory (#1) * Initial commit * Include missing prepared files * Fixes cwd implementation Co-authored-by: Zennon Gosalvez <1798166+zgosalvez@users.noreply.github.com>
1 parent d5ce50e commit 26957ab

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ For more information on these inputs, see the [Workflow syntax for GitHub Action
1616
- `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
1717
- `minimum-coverage`: The minimum coverage to pass the check. Optional. Default: `0` (always passes)
1818
- `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: ``
19+
- `working-directory`: The working directory containing the source files referenced in the LCOV files. Optional. Default: `./`
1920

2021
### Outputs
2122
None.
@@ -46,6 +47,7 @@ jobs:
4647
minimum-coverage: 90
4748
artifact-name: code-coverage-report
4849
github-token: ${{ secrets.GITHUB_TOKEN }}
50+
working-directory: apps/my-first-app
4951
```
5052
5153
### Flutter Workflows

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ inputs:
1515
default: 0
1616
github-token:
1717
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: ``'
18+
working-directory:
19+
description: 'The working directory containing the source files referenced in the LCOV files. Optional. Default: `./`'
1820
runs:
1921
using: 'node12'
2022
main: 'dist/main/index.js'

dist/main/index.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,15 @@ async function run() {
5454
}
5555

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

6162
args.push('--output-directory');
6263
args.push(artifactPath);
6364

64-
await exec.exec('genhtml', args);
65+
await exec.exec('genhtml', args, { cwd: workingDirectory });
6566

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

0 commit comments

Comments
 (0)