diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 370eb38f2..b285d129e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,6 +17,11 @@ jobs: # TODO: add windows matrix os: [macos-latest] + env: + REPO: ${{ github.event.pull_request.head.repo.full_name }} + BRANCH: ${{ github.event.pull_request.head.ref }} + SKIP_POETRY_SHELL: 1 + steps: - name: Checkout code uses: actions/checkout@v3 @@ -28,13 +33,13 @@ jobs: - name: Run tests using the shell script (macOS compatible). if: matrix.os == 'macos-latest' - run: SKIP_POETRY_SHELL=1 sh install/install_openadapt.sh + run: sh install/install_openadapt.sh - name: Checkout code uses: actions/checkout@v3 with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ env.BRANCH }} + repository: ${{ env.REPO }} - name: Install poetry uses: snok/install-poetry@v1 diff --git a/install/install_openadapt.sh b/install/install_openadapt.sh index 277a820cc..2986bc9ca 100644 --- a/install/install_openadapt.sh +++ b/install/install_openadapt.sh @@ -9,6 +9,9 @@ pythonCmd="python3.10" pythonVerStr="Python 3.10*" pythonInstallerLoc="https://www.python.org/ftp/python/3.10.11/python-3.10.11-macos11.pkg" +# Construct the repository URL +REPO_URL="https://github.com/$REPO" + ################################ HELPER FUNCTIONS ################################ # Remove OpenAdapt if it exists @@ -121,9 +124,9 @@ fi CheckPythonExists [ -d "OpenAdapt" ] && mv OpenAdapt OpenAdapt-$(date +%Y-%m-%d_%H-%M-%S) -RunAndCheck "git clone https://github.com/MLDSAI/OpenAdapt.git" "Clone git repo" - +RunAndCheck "git clone $REPO_URL" "Clone git repo" cd OpenAdapt +RunAndCheck "git checkout $BRANCH" "Checkout branch $BRANCH" RunAndCheck "pip3.10 install poetry" "Install Poetry" RunAndCheck "poetry install" "Install Python dependencies"