From a54faf699485d7d82f89f9729df913dc281cee69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Chalk?= Date: Tue, 19 May 2026 16:24:15 +0200 Subject: [PATCH] fix(ci): slugify project name in configPatterns --- packages/ci/README.md | 4 ++-- packages/ci/src/lib/run-utils.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/ci/README.md b/packages/ci/README.md index a2e91dd2df..61aea3aa3f 100644 --- a/packages/ci/README.md +++ b/packages/ci/README.md @@ -244,9 +244,9 @@ if (result.mode === 'monorepo') { ### Faster CI runs with `configPatterns` -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. +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. -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. +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. ```ts await runInCI(refs, api, { diff --git a/packages/ci/src/lib/run-utils.ts b/packages/ci/src/lib/run-utils.ts index de85d885ab..ceb6015f2f 100644 --- a/packages/ci/src/lib/run-utils.ts +++ b/packages/ci/src/lib/run-utils.ts @@ -16,6 +16,7 @@ import { objectFromEntries, readJsonFile, removeUndefinedAndEmptyProps, + slugify, stringifyError, } from '@code-pushup/utils'; import { @@ -510,8 +511,8 @@ export function configFromPatterns( upload: { server: upload.server, apiKey: upload.apiKey, - organization: interpolate(upload.organization, variables), - project: interpolate(upload.project, variables), + organization: slugify(interpolate(upload.organization, variables)), + project: slugify(interpolate(upload.project, variables)), ...(upload.timeout != null && { timeout: upload.timeout }), }, }),