Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: [{
Expand Down
27 changes: 4 additions & 23 deletions src/ciUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep deprecated runTitle from dropping existing titles

Returning undefined unconditionally here is a silent behavioral break for existing callers of CIUtils.runTitle(): in GitHub Actions jobs where GITHUB_WORKFLOW is set, reports that previously got a meaningful title will now lose it unless every consumer is migrated immediately to set title manually. Because the function type is unchanged (string | undefined), this regression is easy to miss in downstream code, so deprecating the API should preserve the prior fallback behavior until removal.

Useful? React with 👍 / 👎.

}

/**
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions tests/ciutils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});