Skip to content

Commit 2a74b02

Browse files
committed
Add output input for customizing reports directory
1 parent b152206 commit 2a74b02

File tree

10 files changed

+179
-142
lines changed

10 files changed

+179
-142
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ The action may be customized using the following optional inputs:
6767
| `artifacts` | Toggles if artifacts will we uploaded/downloaded | `true` |
6868
| `retention` | Artifact retention period in days | from repository settings |
6969
| `directory` | Directory in which `code-pushup` should run | `process.cwd()` |
70+
| `output` | Directory where reports will be created | `.code-pushup` |
7071
| `config` | Path to config file (`--config` option) | see [`@code-pushup/cli` docs](https://github.com/code-pushup/cli/tree/main/packages/cli#configuration) |
7172
| `silent` | Toggles if logs from Code PushUp CLI are printed | `false` |
7273
| `bin` | Command for executing Code PushUp CLI | `npx --no-install code-pushup` |
@@ -150,3 +151,14 @@ can override the name using the optional `task` input:
150151
monorepo: nx
151152
task: analyze # custom Nx target
152153
```
154+
155+
For caching purposes, you may prefer to separate output directories per project.
156+
The `output` input supports interpolating the project name in the path using
157+
`{project}` syntax:
158+
159+
```yml
160+
- uses: code-pushup/github-action@v0
161+
with:
162+
monorepo: true
163+
output: .code-pushup/{project}
164+
```

__tests__/main.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
import { run } from '../src/main'
2424

2525
describe('code-pushup action', () => {
26-
const workDir = join('tmp', 'git-repo')
26+
const workDir = join(process.cwd(), 'tmp', 'git-repo')
2727

2828
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
2929
const getOctokit = () =>
@@ -65,6 +65,7 @@ describe('code-pushup action', () => {
6565
process.env['INPUT_TOKEN'] = '<mock-github-token>'
6666
process.env['INPUT_BIN'] = 'npx code-pushup'
6767
process.env['INPUT_DIRECTORY'] = workDir
68+
process.env['INPUT_OUTPUT'] = '.code-pushup'
6869
process.env['INPUT_RETENTION'] = '14'
6970
process.env['INPUT_TASK'] = 'code-pushup'
7071
process.env['INPUT_SILENT'] = 'true'

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ inputs:
4343
directory:
4444
description: Custom working directory
4545
required: false
46+
output:
47+
description:
48+
Custom report output directory (use '{project}'-syntax in monorepo mode)
49+
required: false
50+
default: .code-pushup
4651
silent:
4752
description: Silence logs from Code Pushup CLI
4853
required: true

badges/coverage.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)