@xcelera/cli 2.3.0 → 2.3.1

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/dist/cli.js CHANGED
@@ -9276,7 +9276,7 @@ var simpleGit = gitInstanceFactory;
9276
9276
 
9277
9277
  async function inferGitContext() {
9278
9278
  if (!(await isGitRepository())) {
9279
- throw new Error('No git repository detected.');
9279
+ return undefined;
9280
9280
  }
9281
9281
  const remoteUrl = await getRemoteUrl();
9282
9282
  const parsed = parseGithubUrl(remoteUrl);
@@ -9326,17 +9326,15 @@ async function getCommit(hash = 'HEAD') {
9326
9326
 
9327
9327
  async function inferBuildContext() {
9328
9328
  const ciEnv = envCi();
9329
- const gitContext = {
9330
- ...(await inferGitContext()),
9331
- branch: ('prBranch' in ciEnv && ciEnv.prBranch ? ciEnv.prBranch : ciEnv.branch) ??
9332
- undefined
9333
- };
9329
+ const gitContext = await inferGitContext();
9330
+ const branch = ('prBranch' in ciEnv && ciEnv.prBranch ? ciEnv.prBranch : ciEnv.branch) ??
9331
+ undefined;
9334
9332
  return {
9335
9333
  service: ciEnv.isCi ? ciEnv.service : 'unknown',
9336
9334
  prNumber: 'pr' in ciEnv ? ciEnv.pr : undefined,
9337
9335
  buildNumber: 'build' in ciEnv ? ciEnv.build : undefined,
9338
9336
  buildUrl: 'buildUrl' in ciEnv ? ciEnv.buildUrl : undefined,
9339
- git: gitContext
9337
+ git: gitContext ? { ...gitContext, branch } : undefined
9340
9338
  };
9341
9339
  }
9342
9340