Skip to content

Commit 39451ba

Browse files
authored
chore: depreacte CIUtils.runTitle() method (#20)
Turns out there's no good way to extract title from the CI.
1 parent 072e655 commit 39451ba

3 files changed

Lines changed: 7 additions & 27 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const env = ReportUtils.createEnvironment({ name: 'CI' });
3434
const report: FlakinessReport.Report = {
3535
category: 'testreport',
3636
commitId: worktree.headCommitId(),
37-
title: CIUtils.runTitle(),
37+
title: process.env.FLAKINESS_TITLE,
3838
url: CIUtils.runUrl(),
3939
environments: [env],
4040
suites: [{

src/ciUtils.ts

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,13 @@
66
*/
77
export namespace CIUtils {
88
/**
9-
* Automatically extracts a human-readable CI run title when available.
9+
* @deprecated Use the `title` reporter option or `FLAKINESS_TITLE` environment variable instead.
10+
* See https://docs.flakiness.io/report/customization/#title
1011
*
11-
* This function attempts to detect the current CI environment and return a
12-
* stable title that identifies the workflow or pipeline generating the report.
13-
*
14-
* Supported CI providers (checked in order):
15-
* - GitHub Actions (via `GITHUB_WORKFLOW`)
16-
*
17-
* @returns {string | undefined} The CI run title, or `undefined` if no supported
18-
* CI environment exposes a stable human-readable title.
19-
*
20-
* @example
21-
* ```typescript
22-
* const report: FlakinessReport.Report = {
23-
* // ... other report properties
24-
* title: CIUtils.runTitle(),
25-
* };
26-
* ```
12+
* @returns {undefined} Always returns `undefined`.
2713
*/
2814
export function runTitle(): string | undefined {
29-
return githubActionsTitle();
15+
return undefined;
3016
}
3117

3218
/**
@@ -57,11 +43,6 @@ export namespace CIUtils {
5743
}
5844
}
5945

60-
function githubActionsTitle(): string | undefined {
61-
const title = process.env.GITHUB_WORKFLOW?.trim();
62-
return title || undefined;
63-
}
64-
6546
function githubActions(): string | undefined {
6647
const serverUrl = process.env.GITHUB_SERVER_URL || 'https://github.com';
6748
const repo = process.env.GITHUB_REPOSITORY;

tests/ciutils.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ test('returns a valid GitHub Actions URL', () => {
1313
expect(() => new URL(url!)).not.toThrow();
1414
});
1515

16-
test('returns a valid runTitle', () => {
17-
test.skip(!isGitHubActions, 'Only runs in GitHub Actions');
16+
test('runTitle is deprecated and returns undefined', () => {
1817
const title = CIUtils.runTitle();
19-
expect(title).toBeTruthy();
18+
expect(title).toBeUndefined();
2019
});

0 commit comments

Comments
 (0)