@flakiness/sdk 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/lib/index.js +8 -0
- package/package.json +1 -1
- package/types/src/ciUtils.d.ts +21 -0
- package/types/src/ciUtils.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -34,6 +34,7 @@ const env = ReportUtils.createEnvironment({ name: 'CI' });
|
|
|
34
34
|
const report: FlakinessReport.Report = {
|
|
35
35
|
category: 'testreport',
|
|
36
36
|
commitId: worktree.headCommitId(),
|
|
37
|
+
title: CIUtils.runTitle(),
|
|
37
38
|
url: CIUtils.runUrl(),
|
|
38
39
|
environments: [env],
|
|
39
40
|
suites: [{
|
|
@@ -82,7 +83,7 @@ Use this entry point when you need to process or manipulate reports in browser-b
|
|
|
82
83
|
## Top-Level Exports
|
|
83
84
|
|
|
84
85
|
### Building Reports
|
|
85
|
-
- **`CIUtils`** - Utilities to extract CI/CD information (run URLs, environment detection)
|
|
86
|
+
- **`CIUtils`** - Utilities to extract CI/CD information (run URLs, run titles, environment detection)
|
|
86
87
|
- **`GithubOIDC`** - GitHub Actions OIDC integration for passwordless Flakiness.io authentication
|
|
87
88
|
- **`GitWorktree`** - Git repository utilities for path conversion and commit information
|
|
88
89
|
- **`ReportUtils`** - Namespace with utilities for report creation and manipulation:
|
package/lib/index.js
CHANGED
|
@@ -7,11 +7,19 @@ var __export = (target, all) => {
|
|
|
7
7
|
// src/ciUtils.ts
|
|
8
8
|
var CIUtils;
|
|
9
9
|
((CIUtils2) => {
|
|
10
|
+
function runTitle() {
|
|
11
|
+
return githubActionsTitle();
|
|
12
|
+
}
|
|
13
|
+
CIUtils2.runTitle = runTitle;
|
|
10
14
|
function runUrl() {
|
|
11
15
|
return githubActions() ?? azure() ?? process.env.CI_JOB_URL ?? process.env.BUILD_URL;
|
|
12
16
|
}
|
|
13
17
|
CIUtils2.runUrl = runUrl;
|
|
14
18
|
})(CIUtils || (CIUtils = {}));
|
|
19
|
+
function githubActionsTitle() {
|
|
20
|
+
const title = process.env.GITHUB_WORKFLOW?.trim();
|
|
21
|
+
return title || void 0;
|
|
22
|
+
}
|
|
15
23
|
function githubActions() {
|
|
16
24
|
const serverUrl = process.env.GITHUB_SERVER_URL || "https://github.com";
|
|
17
25
|
const repo = process.env.GITHUB_REPOSITORY;
|
package/package.json
CHANGED
package/types/src/ciUtils.d.ts
CHANGED
|
@@ -5,6 +5,27 @@
|
|
|
5
5
|
* from various CI/CD environments, including GitHub Actions, Azure DevOps, Jenkins, and others.
|
|
6
6
|
*/
|
|
7
7
|
export declare namespace CIUtils {
|
|
8
|
+
/**
|
|
9
|
+
* Automatically extracts a human-readable CI run title when available.
|
|
10
|
+
*
|
|
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
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
function runTitle(): string | undefined;
|
|
8
29
|
/**
|
|
9
30
|
* Automatically extracts the run URL for common continuous integration providers.
|
|
10
31
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ciUtils.d.ts","sourceRoot":"","sources":["../../src/ciUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,yBAAiB,OAAO,CAAC;IACvB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,SAAgB,MAAM,IAAI,MAAM,GAAG,SAAS,CAE3C;CACF"}
|
|
1
|
+
{"version":3,"file":"ciUtils.d.ts","sourceRoot":"","sources":["../../src/ciUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,yBAAiB,OAAO,CAAC;IACvB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,SAAgB,QAAQ,IAAI,MAAM,GAAG,SAAS,CAE7C;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,SAAgB,MAAM,IAAI,MAAM,GAAG,SAAS,CAE3C;CACF"}
|