Skip to content

Commit 5947011

Browse files
committed
fix(ci): slugify project name in configPatterns
1 parent 5eb3416 commit 5947011

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

packages/ci/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ if (result.mode === 'monorepo') {
244244

245245
### Faster CI runs with `configPatterns`
246246

247-
By default, the `print-config` command is run sequentially for each project in order to reliably detect how `code-pushup` is configured - specifically, where to read output files from (`persist` config) and whether portal may be used as a cache (`upload` config). This allows for each project to be configured in its own way without breaking anything, but for large monorepos these extra `code-pushup print-config` executions can accumulate and significantly slow down CI pipelines.
247+
By default, the `print-config` command is run sequentially for each project in order to reliably detect how `code-pushup` is configured - specifically, where to read output files from (`persist` config) and whether the portal may be used as a cache (`upload` config). This allows for each project to be configured in its own way without breaking anything, but for large monorepos these extra `code-pushup print-config` executions can accumulate and significantly slow down CI pipelines.
248248

249-
As a more scalable alternative, `configPatterns` may be provided. A user declares upfront how every project is configured, which allows `print-config` to be skipped. It's the user's responsibility to ensure this configuration holds for every project (it won't be checked). The `configPatterns` support string interpolation, substituting `{projectName}` with each project's name. Other than that, each project's `code-pushup.config` must have exactly the same `persist` and `upload` configurations.
249+
As a more scalable alternative, `configPatterns` may be provided. A user declares upfront how every project is configured, which allows `print-config` to be skipped. It's the user's responsibility to ensure this configuration holds for every project (it won't be checked). The `configPatterns` support string interpolation, substituting `{projectName}` with each project's (slugified) name. Other than that, each project's `code-pushup.config` must have exactly the same `persist` and `upload` configurations.
250250

251251
```ts
252252
await runInCI(refs, api, {

packages/ci/src/lib/run-utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
objectFromEntries,
1717
readJsonFile,
1818
removeUndefinedAndEmptyProps,
19+
slugify,
1920
stringifyError,
2021
} from '@code-pushup/utils';
2122
import {
@@ -510,8 +511,8 @@ export function configFromPatterns(
510511
upload: {
511512
server: upload.server,
512513
apiKey: upload.apiKey,
513-
organization: interpolate(upload.organization, variables),
514-
project: interpolate(upload.project, variables),
514+
organization: slugify(interpolate(upload.organization, variables)),
515+
project: slugify(interpolate(upload.project, variables)),
515516
...(upload.timeout != null && { timeout: upload.timeout }),
516517
},
517518
}),

0 commit comments

Comments
 (0)