MCPcopy Create free account
hub / github.com/code-pushup/cli / runInBaseBranch

Function runInBaseBranch

packages/ci/src/lib/run-utils.ts:436–453  ·  view source on GitHub ↗
(
  base: GitBranch,
  env: RunEnv,
  fn: () => Promise<T>,
)

Source from the content-addressed store, hash-verified

434}
435
436export async function runInBaseBranch<T>(
437 base: GitBranch,
438 env: RunEnv,
439 fn: () => Promise<T>,
440): Promise<T> {
441 const { git } = env;
442
443 await git.fetch('origin', base.ref, ['--depth=1']);
444 await git.checkout(['-f', base.sha]);
445 logInfo(`Switched to base branch ${base.ref}`);
446
447 const result = await fn();
448
449 await git.checkout(['-f', '-']);
450 logInfo('Switched back to PR/MR branch');
451
452 return result;
453}
454
455export async function checkPrintConfig(
456 args: BaseReportArgs,

Callers 2

collectPreviousReportsFunction · 0.85
collectPreviousReportFunction · 0.85

Calls 2

logInfoFunction · 0.85
fnFunction · 0.50

Tested by

no test coverage detected