Skip to content

Commit 28d6df0

Browse files
Update bito-cra.sh
1 parent bae3b3d commit 28d6df0

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

cra-scripts/bito-cra.sh

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ validate_boolean() {
6969
fi
7070
}
7171

72+
# Function to validate suggestion mode
73+
validate_suggestion_mode() {
74+
local suggestion_mode="$(echo "$1" | awk '{print tolower($0)}')"
75+
if [ "$suggestion_mode" == "comprehensive" ]; then
76+
echo "comprehensive"
77+
else
78+
echo "essential"
79+
fi
80+
}
81+
7282
# Function to validate a mode value i.e. cli or server
7383
validate_mode() {
7484
local mode_val="$1"
@@ -424,6 +434,9 @@ optional_params_cli=(
424434
"exclude_branches"
425435
"include_source_branches"
426436
"include_target_branches"
437+
"post_as_request_changes"
438+
"suggestion_mode"
439+
"locale"
427440
"exclude_files"
428441
"exclude_draft_pr"
429442
"dependency_check"
@@ -443,6 +456,7 @@ optional_params_cli=(
443456
"custom_rules.region_name"
444457
"custom_rules.bucket_name"
445458
"custom_rules.aes_key"
459+
"support_email"
446460
)
447461

448462
# Parameters that are required/optional in mode server
@@ -466,6 +480,9 @@ optional_params_server=(
466480
"exclude_branches"
467481
"include_source_branches"
468482
"include_target_branches"
483+
"post_as_request_changes"
484+
"suggestion_mode"
485+
"locale"
469486
"exclude_files"
470487
"exclude_draft_pr"
471488
"dependency_check"
@@ -485,6 +502,7 @@ optional_params_server=(
485502
"custom_rules.bucket_name"
486503
"custom_rules.aes_key"
487504
"output_path"
505+
"support_email"
488506
)
489507

490508
bee_params=(
@@ -550,7 +568,7 @@ done
550568
for param in "${optional_params[@]}"; do
551569
if [ "$param" == "dependency_check.snyk_auth_token" ] && [ "${props["dependency_check"]}" == "True" ]; then
552570
ask_for_param "$param" "False"
553-
elif [ "$param" != "acceptable_suggestions_enabled" ] && [ "$param" != "dependency_check.snyk_auth_token" ] && [ "$param" != "env" ] && [ "$param" != "cli_path" ] && [ "$param" != "output_path" ] && [ "$param" != "static_analysis_tool" ] && [ "$param" != "linters_feedback" ] && [ "$param" != "secret_scanner_feedback" ] && [ "$param" != "enable_default_branch" ] && [ "$param" != "git.domain" ] && [ "$param" != "review_scope" ] && [ "$param" != "exclude_branches" ] && [ "$param" != "include_source_branches" ] && [ "$param" != "include_target_branches" ] && [ "$param" != "nexus_url" ] && [ "$param" != "exclude_files" ] && [ "$param" != "exclude_draft_pr" ] && [ "$param" != "cr_event_type" ] && [ "$param" != "posting_to_pr" ] && [ "$param" != "custom_rules.configured_ws_ids" ] && [ "$param" != "custom_rules.aws_access_key_id" ] && [ "$param" != "custom_rules.aws_secret_access_key" ] && [ "$param" != "custom_rules.region_name" ] && [ "$param" != "custom_rules.bucket_name" ] && [ "$param" != "custom_rules.aes_key" ] && [ "$param" != "code_context_config.partial_timeout" ] && [ "$param" != "code_context_config.max_depth" ] && [ "$param" != "code_context_config.kill_timeout_sec" ]; then
571+
elif [ "$param" != "acceptable_suggestions_enabled" ] && [ "$param" != "dependency_check.snyk_auth_token" ] && [ "$param" != "env" ] && [ "$param" != "cli_path" ] && [ "$param" != "output_path" ] && [ "$param" != "static_analysis_tool" ] && [ "$param" != "linters_feedback" ] && [ "$param" != "secret_scanner_feedback" ] && [ "$param" != "enable_default_branch" ] && [ "$param" != "git.domain" ] && [ "$param" != "review_scope" ] && [ "$param" != "exclude_branches" ] && [ "$param" != "include_source_branches" ] && [ "$param" != "include_target_branches" ] && [ "$param" != "suggestion_mode" ] && [ "$param" != "locale" ] && [ "$param" != "nexus_url" ] && [ "$param" != "exclude_files" ] && [ "$param" != "exclude_draft_pr" ] && [ "$param" != "cr_event_type" ] && [ "$param" != "posting_to_pr" ] && [ "$param" != "custom_rules.configured_ws_ids" ] && [ "$param" != "custom_rules.aws_access_key_id" ] && [ "$param" != "custom_rules.aws_secret_access_key" ] && [ "$param" != "custom_rules.region_name" ] && [ "$param" != "custom_rules.bucket_name" ] && [ "$param" != "custom_rules.aes_key" ] && [ "$param" != "code_context_config.partial_timeout" ] && [ "$param" != "code_context_config.max_depth" ] && [ "$param" != "code_context_config.kill_timeout_sec" ] && [ "$param" != "post_as_request_changes" ] && [ "$param" != "support_email" ]; then
554572
ask_for_param "$param" "False"
555573
fi
556574
done
@@ -585,6 +603,9 @@ for param in "${required_params[@]}" "${bee_params[@]}" "${optional_params[@]}";
585603
elif [ "$param" == "linters_feedback" ]; then
586604
props[$param]=$(validate_boolean "${props[$param]}")
587605
docker_cmd+=" --linters_feedback=${props[$param]}"
606+
elif [ "$param" == "post_as_request_changes" ]; then
607+
props[$param]=$(validate_boolean "${props[$param]}")
608+
docker_cmd+=" --post_as_request_changes=${props[$param]}"
588609
elif [ "$param" == "secret_scanner_feedback" ]; then
589610
props[$param]=$(validate_boolean "${props[$param]}")
590611
docker_cmd+=" --secret_scanner_feedback=${props[$param]}"
@@ -603,6 +624,11 @@ for param in "${required_params[@]}" "${bee_params[@]}" "${optional_params[@]}";
603624
docker_cmd+=" --include_source_branches='${props[$param]}'"
604625
elif [ "$param" == "include_target_branches" ]; then
605626
docker_cmd+=" --include_target_branches='${props[$param]}'"
627+
elif [ "$param" == "suggestion_mode" ]; then
628+
props[$param]=$(validate_suggestion_mode "${props[$param]}")
629+
docker_cmd+=" --suggestion_mode='${props[$param]}'"
630+
elif [ "$param" == "locale" ]; then
631+
docker_cmd+=" --locale='${props[$param]}'"
606632
elif [ "$param" == "exclude_files" ]; then
607633
docker_cmd+=" --exclude_files='${props[$param]}'"
608634
elif [ "$param" == "exclude_draft_pr" ]; then
@@ -655,6 +681,8 @@ for param in "${required_params[@]}" "${bee_params[@]}" "${optional_params[@]}";
655681
validate_cr_event_type "${props[$param]}"
656682
elif [ "$param" == "posting_to_pr" ]; then
657683
validate_posting_to_pr "${props[$param]}"
684+
elif [ "$param" == "support_email" ]; then
685+
docker_cmd+=" --support_email='${props[$param]}'"
658686
else
659687
docker_cmd+=" --$param=${props[$param]}"
660688
fi

0 commit comments

Comments
 (0)