@@ -20,6 +20,8 @@ into your CI workflows.**
2020 branches, and creates/updates a PR comment which summarizes the impact of the
2121 changes.
2222 - ⚠️ Also annotates changed files with new issues encountered by Code PushUp.
23+ - 🏢 Supports monorepo setups - runs per project and summarizes comparisons in a
24+ single PR comment.
2325
2426## Workflow example
2527
@@ -55,16 +57,19 @@ jobs:
5557
5658The action may be customized using the following optional inputs:
5759
58- | Name | Description | Default |
59- | :------------ | :----------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------- |
60- | ` token` | GitHub token for authorizing GitHub API requests | `${{ github.token }}` |
61- | `annotations` | Toggles if annotations should be created for relevant Code PushUp issues | `true` |
62- | `artifacts` | Toggles if artifacts will we uploaded/downloaded | `true` |
63- | `retention` | Artifact retention period in days | from repository settings |
64- | `directory` | Directory in which `code-pushup` should run | `process.cwd()` |
65- | `config` | Path to config file (`--config` option) | see [`@code-pushup/cli` docs](https://github.com/code-pushup/cli/tree/main/packages/cli#configuration) |
66- | `silent` | Toggles if logs from Code PushUp CLI are printed | `false` |
67- | `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+ | `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+ | `config` | Path to config file (`--config` option) | see [`@code-pushup/cli` docs](https://github.com/code-pushup/cli/tree/main/packages/cli#configuration) |
71+ | `silent` | Toggles if logs from Code PushUp CLI are printed | `false` |
72+ | `bin` | Command for executing Code PushUp CLI | `npx --no-install code-pushup` |
6873
6974For example, this will run `code-pushup` commands in a non-root folder and
7075retain report artifacts for 30 days :
@@ -80,17 +85,68 @@ retain report artifacts for 30 days:
8085
8186Some outputs are set in case you want to add further steps to your workflow.
8287
83- | Name | Description |
84- | :------------ | :---------------------------------------------------- |
85- | `artifact-id` | ID of uploaded report artifact (N/A in monorepo mode) |
86- | `comment-id` | ID of created/updated PR comment |
88+ | Name | Description |
89+ | :------------ | :---------------------------------------------------------------------- |
90+ | `artifact-id` | ID of uploaded report artifact (N/A in [ monorepo mode](#monorepo-mode) ) |
91+ | `comment-id` | ID of created/updated PR comment |
8792
8893Example of using step outputs :
8994
9095` ` ` yml
9196- uses: code-pushup/github-action@v0
9297 id: code-pushup
93- run: |
98+ - run: |
9499 echo "Comment ID is ${{ steps.code-pushup.outputs.comment-id }}"
95100 echo "Artifact ID is ${{ steps.code-pushup.outputs.artifact-id }}"
96101` ` `
102+
103+ # # Monorepo mode
104+
105+ By default, the GitHub Action assumes your repository is a standalone project.
106+ But it also supports monorepo setups where reports are collected and compared
107+ individually per project. All project comparisons are then combined into a
108+ single PR comment.
109+
110+ Use the `monorepo` input to active monorepo mode :
111+
112+ ` ` ` yml
113+ - uses: code-pushup/github-action@v0
114+ with:
115+ monorepo: true
116+ ` ` `
117+
118+ The GitHub Action will try to detect which monorepo tool you're using from the
119+ file system. The following tools are supported out of the box :
120+
121+ - [Nx](https://nx.dev/)
122+ - [Turborepo](https://turbo.build/)
123+ - [Yarn workspaces](https://classic.yarnpkg.com/lang/en/docs/workspaces/)
124+ - [PNPM workspace](https://pnpm.io/workspaces)
125+ - [npm workspaces](https://docs.npmjs.com/cli/using-npm/workspaces)
126+
127+ If you're using one of these tools, you can also skip auto-detection by setting
128+ ` monorepo` input to `nx`, `turbo`, `yarn`, `pnpm` or `npm`.
129+
130+ If none of these tools are detected, then the fallback is to run Code PushUp in
131+ all folders which have a `package.json` file. If that's not what you want, then
132+ you can also configure folder patterns using the optional `projects` input
133+ (comma-separated globs) :
134+
135+ ` ` ` yml
136+ - uses: code-pushup/github-action@v0
137+ with:
138+ monorepo: true
139+ projects: 'frontend, backend/*'
140+ ` ` `
141+
142+ Based on which monorepo tool is used, Code PushUp CLI commands will be executed
143+ using a `package.json` script, Nx target, Turbo task, or binary executable (as
144+ fallback). By default, these are expected to be called `code-pushup`, but you
145+ can override the name using the optional `task` input :
146+
147+ ` ` ` yml
148+ - uses: code-pushup/github-action@v0
149+ with:
150+ monorepo: nx
151+ task: analyze # custom Nx target
152+ ` ` `
0 commit comments