Skip to content

Commit

Permalink
Add output input for customizing reports directory
Browse files Browse the repository at this point in the history
  • Loading branch information
matejchalk committed Nov 25, 2024
1 parent b152206 commit f0a11a4
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 56 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ The action may be customized using the following optional inputs:
| `artifacts` | Toggles if artifacts will we uploaded/downloaded | `true` |
| `retention` | Artifact retention period in days | from repository settings |
| `directory` | Directory in which `code-pushup` should run | `process.cwd()` |
| `output` | Directory where reports will be created | `.code-pushup` |
| `config` | Path to config file (`--config` option) | see [`@code-pushup/cli` docs](https://github.com/code-pushup/cli/tree/main/packages/cli#configuration) |
| `silent` | Toggles if logs from Code PushUp CLI are printed | `false` |
| `bin` | Command for executing Code PushUp CLI | `npx --no-install code-pushup` |
Expand Down Expand Up @@ -150,3 +151,14 @@ can override the name using the optional `task` input:
monorepo: nx
task: analyze # custom Nx target
```

For caching purposes, you may prefer to separate output directories per project.
The `output` input supports interpolating the project name in the path using
`{project}` syntax:

```yml
- uses: code-pushup/github-action@v0
with:
monorepo: true
output: .code-pushup/{project}
```
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ inputs:
directory:
description: Custom working directory
required: false
output:
description:
Custom report output directory (use '{project}'-syntax in monorepo mode)
required: false
silent:
description: Silence logs from Code Pushup CLI
required: true
Expand Down
94 changes: 47 additions & 47 deletions package-lock.json

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

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,19 @@
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0",
"@code-pushup/ci": "^0.54.0",
"@code-pushup/models": "^0.54.0",
"@code-pushup/utils": "^0.54.0",
"@code-pushup/ci": "^0.55.0",
"@code-pushup/models": "^0.55.0",
"@code-pushup/utils": "^0.55.0",
"better-enums": "^0.2.2",
"fast-glob": "^3.3.2",
"simple-git": "^3.27.0",
"yaml": "^2.6.1"
},
"devDependencies": {
"@code-pushup/cli": "^0.54.0",
"@code-pushup/coverage-plugin": "^0.54.0",
"@code-pushup/eslint-plugin": "^0.54.0",
"@code-pushup/js-packages-plugin": "^0.54.0",
"@code-pushup/cli": "^0.55.0",
"@code-pushup/coverage-plugin": "^0.55.0",
"@code-pushup/eslint-plugin": "^0.55.0",
"@code-pushup/js-packages-plugin": "^0.55.0",
"@code-pushup/portal-client": "^0.9.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.9.3",
Expand Down
6 changes: 4 additions & 2 deletions src/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
isMonorepoTool,
type MonorepoTool
} from '@code-pushup/ci'
import { resolve } from 'node:path'

export type ActionInputs = {
monorepo: boolean | MonorepoTool
Expand All @@ -14,6 +13,7 @@ export type ActionInputs = {
bin: string
config: string | null
directory: string
output: string
silent: boolean
artifacts: boolean
retention: number | null
Expand All @@ -26,7 +26,8 @@ export function parseInputs(): ActionInputs {
const task = core.getInput('task')
const token = core.getInput('token')
const config = core.getInput('config') || null
const directory = resolve(core.getInput('directory') || process.cwd())
const directory = core.getInput('directory') || process.cwd()
const output = core.getInput('output')
const bin = core.getInput('bin')
const silent = core.getBooleanInput('silent')
const artifacts = core.getBooleanInput('artifacts')
Expand All @@ -41,6 +42,7 @@ export function parseInputs(): ActionInputs {
bin,
config,
directory,
output,
silent,
artifacts,
retention,
Expand Down
1 change: 1 addition & 0 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export function createOptions(inputs: ActionInputs): Required<Options> {
projects: inputs.projects,
task: inputs.task,
directory: inputs.directory,
output: inputs.output,
bin: inputs.bin,
config: inputs.config,
detectNewIssues: inputs.annotations,
Expand Down

0 comments on commit f0a11a4

Please sign in to comment.