diff --git a/action.yaml b/action.yaml index 182f23e..d729914 100644 --- a/action.yaml +++ b/action.yaml @@ -312,10 +312,19 @@ runs: branch=$(echo "${GITHUB_REF#refs/heads/}") echo "Branch pushed to: $branch" git fetch origin $branch - files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }}) - echo "Files changed: $files" + DBT_DEPLOY=false + # case when the triggered event is a new branch or tag creation, we would need to deploy the dbt project because we cannot determine that it does not need to be deployed + if [[ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]] + then + DBT_DEPLOY=true + files=() + else + files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }}) + echo "files changed: $files" + fi + for file in $files; do if [[ $file =~ ^"${{ inputs.root-folder }}".* ]]; then echo $file is part of configured root folder, so would be triggering a dbt deploy @@ -355,12 +364,21 @@ runs: branch=$(echo "${GITHUB_REF#refs/heads/}") echo "Branch pushed to: $branch" git fetch origin $branch - files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }}) - echo "files changed: $files" DAGS_ONLY_DEPLOY=false SKIP_IMAGE_OR_DAGS_DEPLOY=true + # case when the triggered event is a new branch or tag creation, we would need to deploy the image because we cannot determine that it does not need to be deployed + if [[ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]] + then + DAGS_ONLY_DEPLOY=false + SKIP_IMAGE_OR_DAGS_DEPLOY=false + files=() + else + files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }}) + echo "files changed: $files" + fi + for file in $files; do if [[ $file =~ ^"${{ inputs.root-folder }}".* ]]; then echo $file is part of the input root folder