Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test run bitbucket context #710

Merged
merged 4 commits into from
Nov 4, 2024
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
11 changes: 1 addition & 10 deletions packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,7 @@ export {
TestCaseResult,
TestCaseResultStatus,
} from "./replay/test-run.types";
export {
TestRunEnvironment,
TestRunGitHubContext,
TestRunGitHubPullRequestContext,
TestRunGitHubPushContext,
TestRunGitHubWorkflowDispatchContext,
TestRunGitLabContext,
TestRunGitLabMergeRequestContext,
TestRunGitLabPushContext,
} from "./sdk-bundle-api/sdk-to-bundle/test-run-environment";
export * from "./sdk-bundle-api/sdk-to-bundle/test-run-environment";
export { ReplayableEvent } from "./sdk-bundle-api/bidirectional/replayable-event";
export {
HarEntry,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export interface TestRunEnvironment {
ci?: boolean;
context?: TestRunGitHubContext | TestRunGitLabContext;
context?:
| TestRunGitHubContext
| TestRunGitLabContext
| TestRunBitbucketContext;
[key: string]: unknown;
}

Expand Down Expand Up @@ -117,3 +120,46 @@ export interface TestRunGitLabPushContext {
/** Git ref for the branch (/refs/head/<branch>). Not defined for pushes prior to July 2024. */
ref?: string;
}

export type TestRunBitbucketContext = { type: "bitbucket" } & (
| TestRunBitbucketPullRequestContext
| TestRunBitbucketPushContext
);

export interface TestRunBitbucketPullRequestContext {
event: "pull-request";

/** Pull request title */
title: string;

/** Pull request number */
number: number;

/** Pull request URL (web page) */
htmlUrl: string;

/** Base commit hash */
baseSha: string;

/** Base ref (usually /refs/head/<branch>) */
baseRef: string;

/** Head commit hash */
headSha: string;

/** Head ref (usually /refs/head/<branch>) */
headRef: string;
}

export interface TestRunBitbucketPushContext {
event: "push";

/** Commit hash before the push event */
beforeSha: string;

/** Commit hash after the push event */
afterSha: string;

/** Git ref for the branch (/refs/head/<branch>) */
ref: string;
}
Loading