Skip to content

Commit 589ec96

Browse files
CCM-11701: Make Trivy check dirs exist before running
1 parent 28e07ef commit 589ec96

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/actions/trivy/action.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ runs:
88
components_exit_code=0
99
modules_exit_code=0
1010
11-
./scripts/terraform/trivy.sh ./infrastructure/terraform/components || components_exit_code=$?
12-
./scripts/terraform/trivy.sh ./infrastructure/terraform/modules || modules_exit_code=$?
11+
if [ -d ./infrastructure/terraform/components ]; then
12+
./scripts/terraform/trivy.sh ./infrastructure/terraform/components || components_exit_code=$?
13+
fi
14+
15+
if [ -d ./infrastructure/terraform/modules ]; then
16+
./scripts/terraform/trivy.sh ./infrastructure/terraform/modules || modules_exit_code=$?
17+
fi
1318
1419
if [ $components_exit_code -ne 0 ] || [ $modules_exit_code -ne 0 ]; then
1520
echo "Trivy misconfigurations detected."

0 commit comments

Comments
 (0)