-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathrun.ts
More file actions
33 lines (30 loc) · 940 Bytes
/
run.ts
File metadata and controls
33 lines (30 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { type SimpleGit, simpleGit } from 'simple-git';
import type {
GitRefs,
Options,
ProviderAPIClient,
RunResult,
} from './models.js';
import { runInMonorepoMode } from './run-monorepo.js';
import { runInStandaloneMode } from './run-standalone.js';
import { createRunEnv } from './run-utils.js';
/**
* Runs Code PushUp in CI environment.
* @param refs Git branches (head and optional base)
* @param api API client for given provider
* @param options Additional options (e.g. monorepo mode)
* @param git instance of simple-git - useful for testing
* @returns result of run (standalone or monorepo)
*/
export async function runInCI(
refs: GitRefs,
api: ProviderAPIClient,
options?: Options,
git: SimpleGit = simpleGit(),
): Promise<RunResult> {
const env = await createRunEnv(refs, api, options, git);
if (env.settings.monorepo) {
return runInMonorepoMode(env);
}
return runInStandaloneMode(env);
}