Skip to content

Commit 15df068

Browse files
Update bito-cra.ps1
1 parent 71c1c59 commit 15df068

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

cra-scripts/bito-cra.ps1

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@ function Validate-ReviewComments {
112112
}
113113
}
114114

115+
$crEventType = "automated"
116+
function ValidateCrEventType {
117+
param($crEventTypeVal)
118+
if ($crEventTypeVal -eq "manual"){
119+
return "manual"
120+
}else {
121+
return "automated"
122+
}
123+
}
124+
115125
# Function to display URL using IP address and port
116126
# Run docker ps -l command and store the output
117127
function Display-DockerUrl {
@@ -356,6 +366,8 @@ $optional_params_cli = @(
356366
"static_analysis_tool",
357367
"review_scope",
358368
"exclude_branches",
369+
"exclude_files",
370+
"exclude_draft_pr",
359371
"dependency_check",
360372
"dependency_check.snyk_auth_token",
361373
"cra_version",
@@ -364,6 +376,7 @@ $optional_params_cli = @(
364376
"output_path"
365377
"git.domain"
366378
"code_context"
379+
"cr_event_type"
367380
)
368381

369382
# Parameters that are required/optional in mode server
@@ -381,6 +394,8 @@ $optional_params_server = @(
381394
"static_analysis_tool",
382395
"review_scope",
383396
"exclude_branches",
397+
"exclude_files",
398+
"exclude_draft_pr",
384399
"dependency_check",
385400
"dependency_check.snyk_auth_token",
386401
"server_port",
@@ -389,6 +404,7 @@ $optional_params_server = @(
389404
"cli_path"
390405
"git.domain"
391406
"code_context"
407+
"cr_event_type"
392408
)
393409

394410
$bee_params = @(
@@ -457,7 +473,7 @@ foreach ($param in $required_params) {
457473
foreach ($param in $optional_params) {
458474
if ($param -eq "dependency_check.snyk_auth_token" -and $props["dependency_check"] -eq "True") {
459475
Ask-For-Param $param $false
460-
} elseif ($param -ne "dependency_check.snyk_auth_token" -and $param -ne "env" -and $param -ne "cli_path" -and $param -ne "output_path" -and $param -ne "static_analysis_tool" -and $param -ne "git.domain" -and $param -ne "review_scope" -and $param -ne "exclude_branches") {
476+
} elseif ($param -ne "dependency_check.snyk_auth_token" -and $param -ne "env" -and $param -ne "cli_path" -and $param -ne "output_path" -and $param -ne "static_analysis_tool" -and $param -ne "git.domain" -and $param -ne "review_scope" -and $param -ne "exclude_branches" -and $param -ne "exclude_files" -and $param -ne "exclude_draft_pr" -and $param -ne "cr_event_type") {
461477
Ask-For-Param $param $false
462478
}
463479
}
@@ -487,7 +503,11 @@ foreach ($param in $required_params + $bee_params + $optional_params) {
487503
$scopes = $($props[$param]) -replace ',\s*', ','
488504
$docker_cmd += " --$param='[$scopes]'"
489505
} elseif ($param -eq "exclude_branches") {
490-
$docker_cmd += " --exclude_branches=$($props[$param])"
506+
$docker_cmd += " --exclude_branches='$($props[$param])'"
507+
} elseif ($param -eq "exclude_files") {
508+
$docker_cmd += " --exclude_files='$($props[$param])'"
509+
} elseif ($param -eq "exclude_draft_pr") {
510+
$docker_cmd += " --exclude_draft_pr=$($props[$param])"
491511
} elseif ($param -eq "dependency_check") {
492512
$validated_boolean = Validate-Boolean $props[$param]
493513
$docker_cmd += " --dependency_check.enabled=$validated_boolean"
@@ -518,11 +538,14 @@ foreach ($param in $required_params + $bee_params + $optional_params) {
518538
} elseif ($param -eq "review_comments") {
519539
$review_comments = Validate-ReviewComments $props[$param]
520540
$docker_cmd += " --$param=$review_comments"
541+
} elseif ($param -eq "cr_event_type") {
542+
$crEventType = ValidateCrEventType $props[$param]
521543
} else {
522544
$docker_cmd += " --$param=$($props[$param])"
523545
}
524546
}
525547
}
548+
$docker_cmd += " --cr_event_type=$crEventType"
526549

527550
$docker_cmd = $docker_init_cmd + $docker_cmd
528551
$param_bito_access_key = "bito_cli.bito.access_key"

0 commit comments

Comments
 (0)