From a91a180dd64aae722b35ec56db230ae8e6aa2a88 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Mon, 23 Mar 2026 21:23:41 -0600 Subject: [PATCH] chore: depreacte `CIUtils.runTitle()` method Turns out there's no good way to extract title from the CI. --- README.md | 2 +- src/ciUtils.ts | 27 ++++----------------------- tests/ciutils.spec.ts | 5 ++--- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 952510b..a911064 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ const env = ReportUtils.createEnvironment({ name: 'CI' }); const report: FlakinessReport.Report = { category: 'testreport', commitId: worktree.headCommitId(), - title: CIUtils.runTitle(), + title: process.env.FLAKINESS_TITLE, url: CIUtils.runUrl(), environments: [env], suites: [{ diff --git a/src/ciUtils.ts b/src/ciUtils.ts index 6aa2c97..562eb1f 100644 --- a/src/ciUtils.ts +++ b/src/ciUtils.ts @@ -6,27 +6,13 @@ */ export namespace CIUtils { /** - * Automatically extracts a human-readable CI run title when available. + * @deprecated Use the `title` reporter option or `FLAKINESS_TITLE` environment variable instead. + * See https://docs.flakiness.io/report/customization/#title * - * This function attempts to detect the current CI environment and return a - * stable title that identifies the workflow or pipeline generating the report. - * - * Supported CI providers (checked in order): - * - GitHub Actions (via `GITHUB_WORKFLOW`) - * - * @returns {string | undefined} The CI run title, or `undefined` if no supported - * CI environment exposes a stable human-readable title. - * - * @example - * ```typescript - * const report: FlakinessReport.Report = { - * // ... other report properties - * title: CIUtils.runTitle(), - * }; - * ``` + * @returns {undefined} Always returns `undefined`. */ export function runTitle(): string | undefined { - return githubActionsTitle(); + return undefined; } /** @@ -57,11 +43,6 @@ export namespace CIUtils { } } -function githubActionsTitle(): string | undefined { - const title = process.env.GITHUB_WORKFLOW?.trim(); - return title || undefined; -} - function githubActions(): string | undefined { const serverUrl = process.env.GITHUB_SERVER_URL || 'https://github.com'; const repo = process.env.GITHUB_REPOSITORY; diff --git a/tests/ciutils.spec.ts b/tests/ciutils.spec.ts index 79654c6..2fc10f8 100644 --- a/tests/ciutils.spec.ts +++ b/tests/ciutils.spec.ts @@ -13,8 +13,7 @@ test('returns a valid GitHub Actions URL', () => { expect(() => new URL(url!)).not.toThrow(); }); -test('returns a valid runTitle', () => { - test.skip(!isGitHubActions, 'Only runs in GitHub Actions'); +test('runTitle is deprecated and returns undefined', () => { const title = CIUtils.runTitle(); - expect(title).toBeTruthy(); + expect(title).toBeUndefined(); });