Skip to content

Commit 43a5479

Browse files
committed
[ ci ] re 3067: fix CI on main branch
The extra CI jobs introduced in idris-lang#3067 work fine as long as 'main' is not the checked out branch. This is due to the fetch to a new branch, which git does (reasonably) not allow when you're trying to fetch 'main' into a new branch that's also called 'main'. In this case, we should just `git pull origin main`, which is what the script now (hopefully) does.
1 parent 0029257 commit 43a5479

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

.github/workflows/ci-idris2-and-libs.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,14 @@ jobs:
627627
- name: Build idris2-pack
628628
run: |
629629
git config --global --add safe.directory "${PWD}"
630-
git fetch "https://github.com/${GITHUB_REPOSITORY}" "${GITHUB_REF}:${GITHUB_REF_NAME}"
630+
631+
# only fetch to a new branch if we're not on main (otherwise, git complains)
632+
if [[ $(git branch --show-current) != 'main' ]]
633+
then git fetch "https://github.com/${GITHUB_REPOSITORY}" "${GITHUB_REF}:${GITHUB_REF_NAME}"
634+
else git pull origin main
635+
fi
636+
637+
# rebuild pack with the fetched Idris2
631638
pack install pack
632639
633640
######################################################################
@@ -663,7 +670,13 @@ jobs:
663670
- name: Build pack with PR-Idris
664671
run: |
665672
git config --global --add safe.directory "${PWD}"
666-
git fetch "https://github.com/${GITHUB_REPOSITORY}" "${GITHUB_REF}:${GITHUB_REF_NAME}"
673+
674+
# only fetch to a new branch if we're not on main (otherwise, git complains)
675+
if [[ $(git branch --show-current) != 'main' ]]
676+
then git fetch "https://github.com/${GITHUB_REPOSITORY}" "${GITHUB_REF}:${GITHUB_REF_NAME}"
677+
else git pull origin main
678+
fi
679+
667680
pack install pack
668681
- name: Build+install idris2-lsp
669682
run: |

0 commit comments

Comments
 (0)