@@ -6,9 +6,7 @@ import { getRepoName, gitBranch } from '../../utils/git.mts'
66import { serializeResultJson } from '../../utils/serialize-result-json.mts'
77import { handleCreateNewScan } from '../scan/handle-create-new-scan.mts'
88
9- const { SOCKET_DEFAULT_BRANCH , SOCKET_DEFAULT_REPOSITORY } = constants
10-
11- export async function handleCI ( autoManifest : boolean ) : Promise < void > {
9+ export async function handleCi ( autoManifest : boolean ) : Promise < void > {
1210 // ci: {
1311 // description: 'Alias for "report create --view --strict"',
1412 // argv: ['report', 'create', '--view', '--strict']
@@ -22,23 +20,27 @@ export async function handleCI(autoManifest: boolean): Promise<void> {
2220 }
2321
2422 const cwd = process . cwd ( )
23+ // Lazily access constants.SOCKET_DEFAULT_BRANCH.
24+ const branchName = ( await gitBranch ( cwd ) ) || constants . SOCKET_DEFAULT_BRANCH
25+ // Lazily access constants.SOCKET_DEFAULT_REPOSITORY.
26+ const repoName =
27+ ( await getRepoName ( cwd ) ) || constants . SOCKET_DEFAULT_REPOSITORY
2528
26- // TODO: does it makes sense to use custom branch/repo names here? probably socket.yml, right
2729 await handleCreateNewScan ( {
2830 autoManifest,
29- branchName : ( await gitBranch ( cwd ) ) || SOCKET_DEFAULT_BRANCH ,
31+ branchName,
3032 commitMessage : '' ,
3133 commitHash : '' ,
3234 committers : '' ,
33- cwd : process . cwd ( ) ,
35+ cwd,
3436 defaultBranch : false ,
3537 interactive : false ,
3638 orgSlug : result . data ,
3739 outputKind : 'json' ,
3840 // When 'pendingHead' is true, it requires 'branchName' set and 'tmp' false.
3941 pendingHead : true ,
4042 pullRequest : 0 ,
41- repoName : ( await getRepoName ( cwd ) ) || SOCKET_DEFAULT_REPOSITORY ,
43+ repoName,
4244 readOnly : false ,
4345 report : true ,
4446 targets : [ '.' ] ,
0 commit comments