From 123974803586efa9000d3f52875dbe1e349b4882 Mon Sep 17 00:00:00 2001 From: MFA-X-AI Date: Wed, 24 Jan 2024 17:22:53 +0800 Subject: [PATCH] fix test workflow if ran from master, set xircuits lib install --- .github/workflows/run-workflow-tests.yml | 26 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/run-workflow-tests.yml b/.github/workflows/run-workflow-tests.yml index 88fc89f..98dd710 100644 --- a/.github/workflows/run-workflow-tests.yml +++ b/.github/workflows/run-workflow-tests.yml @@ -22,19 +22,27 @@ jobs: - name: Install xircuits run: pip install xircuits - - name: List xircuits - run: xircuits list - - - name: Set COMPONENT_LIBRARY_PATH + - name: Set Environment Variables run: | - REPO_NAME="${GITHUB_REPOSITORY##*/}" - COMPONENT_LIBRARY_PATH=$(echo "xai_components/xai_${REPO_NAME}" | sed 's/-/_/g') + LIBRARY_NAME=$(echo "${GITHUB_REPOSITORY##*/}" | sed 's/-/_/g') + echo "LIBRARY_NAME=$LIBRARY_NAME" >> $GITHUB_ENV + COMPONENT_LIBRARY_PATH="xai_components/${LIBRARY_NAME}" echo "COMPONENT_LIBRARY_PATH=$COMPONENT_LIBRARY_PATH" >> $GITHUB_ENV - - name: Clone Pull Request + - name: List Xircuits + run: xircuits list + + - name: Clone Repository run: | - PR_BRANCH=${{ github.event.pull_request.head.ref }} - git clone -b $PR_BRANCH https://github.com/${{ github.repository }} ${{ env.COMPONENT_LIBRARY_PATH }} + if [ "${{ github.ref }}" == "refs/heads/main" ]; then + git clone https://github.com/${{ github.repository }} ${{ env.COMPONENT_LIBRARY_PATH }} + else + PR_BRANCH=${{ github.event.pull_request.head.ref }} + git clone -b $PR_BRANCH https://github.com/${{ github.repository }} ${{ env.COMPONENT_LIBRARY_PATH }} + fi + + - name: Install Component Library + run: xircuits install ${LIBRARY_NAME} - name: Test .xircuits Workflows run: |