name: "ADF linking"
description: "ADF linking"

runs:
  using: "composite"
  steps:
    - uses: Alfresco/alfresco-build-tools/.github/actions/get-commit-message@v8.16.0
    - name: clone and install
      shell: bash
      run: |
        if [[ $COMMIT_MESSAGE == *"[link-adf:"* ]]; then
          echo "BUILD_OPTS=--configuration=adf,e2e" >> $GITHUB_ENV
          echo "TEST_OPTS=--configuration=adfprod" >> $GITHUB_ENV
          echo "E2E_TSCONFIG=tsconfig.e2e.adf.json" >> $GITHUB_ENV

          BRANCH=`echo $COMMIT_MESSAGE | grep -o "\[link-adf\:[^]]*\]" | sed -e 's#\[link-adf:##g' | sed -e 's#\]##g'`
          echo "Cloning ADF with branch ${BRANCH}" && \
          git clone https://github.com/Alfresco/alfresco-ng2-components.git --depth=1 --branch ${BRANCH} ../alfresco-ng2-components
          # ADF theming needs it the styling
          CWD=`pwd`
          cd ../alfresco-ng2-components
          npm install @angular/material
          cd $CWD
        else
          echo -e "Using ADF from installed node_modules."
        fi ;
