From 4d1a3b144732cda4ee610b53ceacd333ae0c45ef Mon Sep 17 00:00:00 2001 From: George Taylor Date: Mon, 6 Mar 2023 17:21:32 +0000 Subject: [PATCH] Fix for #191 (#192) * replace git diff with git diff-tree * Update entrypoint.sh --- terraform-static-analysis/entrypoint.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/terraform-static-analysis/entrypoint.sh b/terraform-static-analysis/entrypoint.sh index 186a09cd..2420c996 100755 --- a/terraform-static-analysis/entrypoint.sh +++ b/terraform-static-analysis/entrypoint.sh @@ -32,8 +32,11 @@ declare -i checkov_exitcode=0 declare -i tflint_exitcode=0 declare -i tfinit_exitcode=0 +# see https://github.com/actions/runner/issues/2033 +git config --global --add safe.directory /github/workspace + # Identify which Terraform folders have changes and need scanning -tf_folders_with_changes=`git diff --no-commit-id --name-only -r @^ | awk '{print $1}' | grep '\.tf' | sed 's#/[^/]*$##' | grep -v '\.tf' | uniq` +tf_folders_with_changes=`git diff-tree --no-commit-id --name-only -r @^ | awk '{print $1}' | grep '\.tf' | sed 's#/[^/]*$##' | grep -v '\.tf' | uniq` echo echo "TF folders with changes" echo $tf_folders_with_changes