diff --git a/.github/workflows/ci-idris2-and-libs.yml b/.github/workflows/ci-idris2-and-libs.yml index f7d5fe322..9cc21f626 100644 --- a/.github/workflows/ci-idris2-and-libs.yml +++ b/.github/workflows/ci-idris2-and-libs.yml @@ -627,7 +627,14 @@ jobs: - name: Build idris2-pack run: | git config --global --add safe.directory "${PWD}" - git fetch "https://github.com/${GITHUB_REPOSITORY}" "${GITHUB_REF}:${GITHUB_REF_NAME}" + + # only fetch to a new branch if we're not on main (otherwise, git complains) + if [[ $(git branch --show-current) != 'main' ]] + then git fetch "https://github.com/${GITHUB_REPOSITORY}" "${GITHUB_REF}:${GITHUB_REF_NAME}" + else git pull origin main + fi + + # rebuild pack with the fetched Idris2 pack install pack ###################################################################### @@ -663,7 +670,13 @@ jobs: - name: Build pack with PR-Idris run: | git config --global --add safe.directory "${PWD}" - git fetch "https://github.com/${GITHUB_REPOSITORY}" "${GITHUB_REF}:${GITHUB_REF_NAME}" + + # only fetch to a new branch if we're not on main (otherwise, git complains) + if [[ $(git branch --show-current) != 'main' ]] + then git fetch "https://github.com/${GITHUB_REPOSITORY}" "${GITHUB_REF}:${GITHUB_REF_NAME}" + else git pull origin main + fi + pack install pack - name: Build+install idris2-lsp run: |