Skip to content

Commit f0a11a4

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

File tree

6 files changed

+75
-56
lines changed

6 files changed

+75
-56
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+
```

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ 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
4650
silent:
4751
description: Silence logs from Code Pushup CLI
4852
required: true

package-lock.json

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

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,19 @@
8080
"@actions/core": "^1.11.1",
8181
"@actions/exec": "^1.1.1",
8282
"@actions/github": "^6.0.0",
83-
"@code-pushup/ci": "^0.54.0",
84-
"@code-pushup/models": "^0.54.0",
85-
"@code-pushup/utils": "^0.54.0",
83+
"@code-pushup/ci": "^0.55.0",
84+
"@code-pushup/models": "^0.55.0",
85+
"@code-pushup/utils": "^0.55.0",
8686
"better-enums": "^0.2.2",
8787
"fast-glob": "^3.3.2",
8888
"simple-git": "^3.27.0",
8989
"yaml": "^2.6.1"
9090
},
9191
"devDependencies": {
92-
"@code-pushup/cli": "^0.54.0",
93-
"@code-pushup/coverage-plugin": "^0.54.0",
94-
"@code-pushup/eslint-plugin": "^0.54.0",
95-
"@code-pushup/js-packages-plugin": "^0.54.0",
92+
"@code-pushup/cli": "^0.55.0",
93+
"@code-pushup/coverage-plugin": "^0.55.0",
94+
"@code-pushup/eslint-plugin": "^0.55.0",
95+
"@code-pushup/js-packages-plugin": "^0.55.0",
9696
"@code-pushup/portal-client": "^0.9.0",
9797
"@types/jest": "^29.5.14",
9898
"@types/node": "^22.9.3",

src/inputs.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
isMonorepoTool,
55
type MonorepoTool
66
} from '@code-pushup/ci'
7-
import { resolve } from 'node:path'
87

98
export type ActionInputs = {
109
monorepo: boolean | MonorepoTool
@@ -14,6 +13,7 @@ export type ActionInputs = {
1413
bin: string
1514
config: string | null
1615
directory: string
16+
output: string
1717
silent: boolean
1818
artifacts: boolean
1919
retention: number | null
@@ -26,7 +26,8 @@ export function parseInputs(): ActionInputs {
2626
const task = core.getInput('task')
2727
const token = core.getInput('token')
2828
const config = core.getInput('config') || null
29-
const directory = resolve(core.getInput('directory') || process.cwd())
29+
const directory = core.getInput('directory') || process.cwd()
30+
const output = core.getInput('output')
3031
const bin = core.getInput('bin')
3132
const silent = core.getBooleanInput('silent')
3233
const artifacts = core.getBooleanInput('artifacts')
@@ -41,6 +42,7 @@ export function parseInputs(): ActionInputs {
4142
bin,
4243
config,
4344
directory,
45+
output,
4446
silent,
4547
artifacts,
4648
retention,

src/options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export function createOptions(inputs: ActionInputs): Required<Options> {
88
projects: inputs.projects,
99
task: inputs.task,
1010
directory: inputs.directory,
11+
output: inputs.output,
1112
bin: inputs.bin,
1213
config: inputs.config,
1314
detectNewIssues: inputs.annotations,

0 commit comments

Comments
 (0)