@@ -42,11 +42,46 @@ if [[ -n "$REGISTRIES" ]]; then
4242else
4343 echo " ⚠️ No REGISTRIES specified, skipping auth.json creation."
4444fi
45- # ------------------------------------------------------
4645
47- # Parse additional params into array
48- eval " arr=(${ADDITIONAL_PARAMS} )"
49- /app/bin/cx scan create --project-name " ${PROJECT_NAME} " -s " ${SOURCE_DIR} " --branch " ${BRANCH# refs/ heads/ } " --scan-info-format json --agent " Github Action" " ${arr[@]} " | tee -i $output_file
46+ # Parse global params (applied to all commands)
47+ if [ -n " ${GLOBAL_PARAMS} " ]; then
48+ eval " global_arr=(${GLOBAL_PARAMS} )"
49+ else
50+ global_arr=()
51+ fi
52+
53+ # Parse scan-specific params
54+ if [ -n " ${SCAN_PARAMS} " ]; then
55+ eval " scan_arr=(${SCAN_PARAMS} )"
56+ else
57+ scan_arr=()
58+ fi
59+
60+ # Parse utils-specific params
61+ if [ -n " ${UTILS_PARAMS} " ]; then
62+ eval " utils_arr=(${UTILS_PARAMS} )"
63+ else
64+ utils_arr=()
65+ fi
66+
67+ # Parse results-specific params
68+ if [ -n " ${RESULTS_PARAMS} " ]; then
69+ eval " results_arr=(${RESULTS_PARAMS} )"
70+ else
71+ results_arr=()
72+ fi
73+
74+ # Backward compatibility: Support ADDITIONAL_PARAMS
75+ if [ -n " ${ADDITIONAL_PARAMS} " ] && [ -z " ${SCAN_PARAMS} " ]; then
76+ echo " ⚠️ ADDITIONAL_PARAMS is deprecated. Please use SCAN_PARAMS instead."
77+ eval " scan_arr=(${ADDITIONAL_PARAMS} )"
78+ fi
79+
80+ # Combine global + scan-specific params
81+ combined_scan_params=(" ${global_arr[@]} " " ${scan_arr[@]} " )
82+
83+
84+ /app/bin/cx scan create --project-name " ${PROJECT_NAME} " -s " ${SOURCE_DIR} " --branch " ${BRANCH# refs/ heads/ } " --scan-info-format json --agent " Github Action" " ${combined_scan_params[@]} " | tee -i $output_file
5085exitCode=${PIPESTATUS[0]}
5186
5287scanId=(` grep -E ' "(ID)":"((\\"|[^"])*)"' $output_file | cut -d' ,' -f1 | cut -d' :' -f2 | tr -d ' "' ` )
@@ -55,14 +90,18 @@ echo "cxcli=$(cat $output_file | tr -d '\r\n')" >> $GITHUB_OUTPUT
5590
5691if [ -n " $scanId " ] && [ -n " ${PR_NUMBER} " ]; then
5792 echo " Creating PR decoration for scan ID:" $scanId
58- /app/bin/cx utils pr github --scan-id " ${scanId} " --namespace " ${NAMESPACE} " --repo-name " ${REPO_NAME} " --pr-number " ${PR_NUMBER} " --token " ${GITHUB_TOKEN} "
93+ # Combine global + utils-specific params
94+ combined_utils_params=(" ${global_arr[@]} " " ${utils_arr[@]} " )
95+ /app/bin/cx utils pr github --scan-id " ${scanId} " --namespace " ${NAMESPACE} " --repo-name " ${REPO_NAME} " --pr-number " ${PR_NUMBER} " --token " ${GITHUB_TOKEN} " " ${combined_utils_params[@]} "
5996else
6097 echo " PR decoration not created."
6198fi
6299
63100
64101if [ -n " $scanId " ]; then
65- /app/bin/cx results show --scan-id " ${scanId} " --report-format markdown
102+ # Combine global + results-specific params
103+ combined_results_params=(" ${global_arr[@]} " " ${results_arr[@]} " )
104+ /app/bin/cx results show --scan-id " ${scanId} " --report-format markdown " ${combined_results_params[@]} "
66105 cat ./cx_result.md > $GITHUB_STEP_SUMMARY
67106 rm ./cx_result.md
68107 echo " cxScanID=$scanId " >> $GITHUB_OUTPUT
0 commit comments