Deploy on changes in specific directory

Hello,

Is it possible to catch which directory was changed to deploy something with the $DIR_NAME variable?

I have tried to do this using bash, but there is a question, about how to do this and use it in other stages in the pipeline

  • *build:
    stage: build
    before_script:

    • export CHANGED_DIRS=$(git diff --dirstat=files,0 HEAD~1 | sed -E ‘s/[1]+% //g’ | cut -d/ -f 1-2 | uniq)
      script:
    • for i in “${CHANGED_DIRS[@]}”; do
      echo “$i”;
      if [ $(echo “$i” | cut -d “/” -f 1) == “products” ]; then
      echo “$i” | cut -d “/” -f 2;
      fi;
      done*
    • Also strange how bash works*

Thanks :blush:


  1. 0-9. ↩︎