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 2a74b02
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 142 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}
```
3 changes: 2 additions & 1 deletion __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
import { run } from '../src/main'

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

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
const getOctokit = () =>
Expand Down Expand Up @@ -65,6 +65,7 @@ describe('code-pushup action', () => {
process.env['INPUT_TOKEN'] = '<mock-github-token>'
process.env['INPUT_BIN'] = 'npx code-pushup'
process.env['INPUT_DIRECTORY'] = workDir
process.env['INPUT_OUTPUT'] = '.code-pushup'
process.env['INPUT_RETENTION'] = '14'
process.env['INPUT_TASK'] = 'code-pushup'
process.env['INPUT_SILENT'] = 'true'
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ inputs:
directory:
description: Custom working directory
required: false
output:
description:
Custom report output directory (use '{project}'-syntax in monorepo mode)
required: false
default: .code-pushup
silent:
description: Silence logs from Code Pushup CLI
required: true
Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2a74b02

Please sign in to comment.