Skip to content

Commit bb49c43

Browse files
committed
Add nxProjectsFilter option
1 parent b365227 commit bb49c43

File tree

8 files changed

+115
-75
lines changed

8 files changed

+115
-75
lines changed

README.md

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,21 @@ jobs:
5757
5858
The action may be customized using the following optional inputs:
5959
60-
| Name | Description | Default |
61-
| :------------ | :-------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------- |
62-
| `monorepo` | Enables [monorepo mode](#monorepo-mode) | `false` |
63-
| `projects` | Custom projects configuration for [monorepo mode](#monorepo-mode) | none |
64-
| `task` | Name of command to run Code PushUp per project in [monorepo mode](#monorepo-mode) | `code-pushup` |
65-
| `token` | GitHub token for authorizing GitHub API requests | `${{ github.token }}` |
66-
| `annotations` | Toggles if annotations should be created for relevant Code PushUp issues | `true` |
67-
| `artifacts` | Toggles if artifacts will we uploaded/downloaded | `true` |
68-
| `retention` | Artifact retention period in days | from repository settings |
69-
| `directory` | Directory in which `code-pushup` should run | `process.cwd()` |
70-
| `output` | Directory where reports will be created | `.code-pushup` |
71-
| `config` | Path to config file (`--config` option) | see [`@code-pushup/cli` docs](https://github.com/code-pushup/cli/tree/main/packages/cli#configuration) |
72-
| `silent` | Toggles if logs from Code PushUp CLI are printed | `false` |
73-
| `bin` | Command for executing Code PushUp CLI | `npx --no-install code-pushup` |
60+
| Name | Description | Default |
61+
| :----------------- | :-------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------- |
62+
| `monorepo` | Enables [monorepo mode](#monorepo-mode) | `false` |
63+
| `projects` | Custom projects configuration for [monorepo mode](#monorepo-mode) | none |
64+
| `task` | Name of command to run Code PushUp per project in [monorepo mode](#monorepo-mode) | `code-pushup` |
65+
| `nxProjectsFilter` | CLI arguments used to filter Nx projects in [monorepo mode](#monorepo-mode) | `--with-target={task}` |
66+
| `token` | GitHub token for authorizing GitHub API requests | `${{ github.token }}` |
67+
| `annotations` | Toggles if annotations should be created for relevant Code PushUp issues | `true` |
68+
| `artifacts` | Toggles if artifacts will we uploaded/downloaded | `true` |
69+
| `retention` | Artifact retention period in days | from repository settings |
70+
| `directory` | Directory in which `code-pushup` should run | `process.cwd()` |
71+
| `output` | Directory where reports will be created | `.code-pushup` |
72+
| `config` | Path to config file (`--config` option) | see [`@code-pushup/cli` docs](https://github.com/code-pushup/cli/tree/main/packages/cli#configuration) |
73+
| `silent` | Toggles if logs from Code PushUp CLI are printed | `false` |
74+
| `bin` | Command for executing Code PushUp CLI | `npx --no-install code-pushup` |
7475

7576
For example, this will run `code-pushup` commands in a non-root folder and
7677
retain report artifacts for 30 days:
@@ -162,3 +163,19 @@ The `output` input supports interpolating the project name in the path using
162163
monorepo: true
163164
output: .code-pushup/{project}
164165
```
166+
167+
In Nx monorepos, projects are listed using
168+
`nx show projects --with-target=code-pushup` by default. The `nxProjectsFilter`
169+
input sets the CLI arguments forwarded to
170+
[`nx show projects`](https://nx.dev/nx-api/nx/documents/show#projects) (default
171+
is `--with-target={task}`, with `{task}` being replaced by the `task` input
172+
value). This gives a lot of flexibility in customizing which Nx projects should
173+
be run:
174+
175+
```yml
176+
- uses: code-pushup/github-action@v0
177+
with:
178+
monorepo: nx
179+
nxProjectsFilter:
180+
'--with-target=code-pushup --affected --projects=apps/* exclude=*-e2e'
181+
```

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ inputs:
3333
Dependending on what monorepo tool is being used, this task may represent a `package.json` script, binary executable, Nx target or Turbo task.
3434
required: true
3535
default: code-pushup
36+
nxProjectsFilter:
37+
description: |
38+
CLI arguments for `nx show projects` used to list Nx projects in monorepo mode. Replaces `{task}` with `task` input.
39+
required: true
40+
default: --with-target={task}
3641
bin:
3742
description: Custom code-pushup executable
3843
required: true

dist/index.js

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

dist/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.

package-lock.json

Lines changed: 45 additions & 45 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.55.0",
84-
"@code-pushup/models": "^0.55.0",
85-
"@code-pushup/utils": "^0.55.0",
83+
"@code-pushup/ci": "^0.56.0",
84+
"@code-pushup/models": "^0.56.0",
85+
"@code-pushup/utils": "^0.56.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.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",
92+
"@code-pushup/cli": "^0.56.0",
93+
"@code-pushup/coverage-plugin": "^0.56.0",
94+
"@code-pushup/eslint-plugin": "^0.56.0",
95+
"@code-pushup/js-packages-plugin": "^0.56.0",
9696
"@code-pushup/portal-client": "^0.9.0",
9797
"@types/jest": "^29.5.14",
9898
"@types/node": "^22.9.3",

0 commit comments

Comments
 (0)