From 589ec96898b443becaabea24c4512b2bfff616c4 Mon Sep 17 00:00:00 2001 From: jamesthompson26-nhs Date: Fri, 15 Aug 2025 13:24:47 +0100 Subject: [PATCH] CCM-11701: Make Trivy check dirs exist before running --- .github/actions/trivy/action.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/actions/trivy/action.yaml b/.github/actions/trivy/action.yaml index be940ce5..010386ee 100644 --- a/.github/actions/trivy/action.yaml +++ b/.github/actions/trivy/action.yaml @@ -8,8 +8,13 @@ runs: components_exit_code=0 modules_exit_code=0 - ./scripts/terraform/trivy.sh ./infrastructure/terraform/components || components_exit_code=$? - ./scripts/terraform/trivy.sh ./infrastructure/terraform/modules || modules_exit_code=$? + if [ -d ./infrastructure/terraform/components ]; then + ./scripts/terraform/trivy.sh ./infrastructure/terraform/components || components_exit_code=$? + fi + + if [ -d ./infrastructure/terraform/modules ]; then + ./scripts/terraform/trivy.sh ./infrastructure/terraform/modules || modules_exit_code=$? + fi if [ $components_exit_code -ne 0 ] || [ $modules_exit_code -ne 0 ]; then echo "Trivy misconfigurations detected."