Skip to content

Commit

Permalink
Fix GHA when opam-rt uses a diverging API
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate committed Dec 11, 2024
1 parent e131094 commit 5cf3840
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions .github/scripts/main/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,18 @@ if [ "$OPAM_TEST" = "1" ]; then
fi
cd $CACHE/opam-rt
git fetch origin
if git ls-remote --exit-code origin $BRANCH ; then
if git branch | grep -q $BRANCH; then
git checkout $BRANCH
git reset --hard origin/$BRANCH
else
git checkout -b $BRANCH origin/$BRANCH
fi
if git ls-remote --exit-code origin "$BRANCH"; then
OPAM_RT_BRANCH=$BRANCH
elif [ "$GITHUB_EVENT_NAME" = pull_request ] && git ls-remote --exit-code origin "$GITHUB_BASE_REF"; then
OPAM_RT_BRANCH=$GITHUB_BASE_REF
else
OPAM_RT_BRANCH=master
fi
if git branch | grep -q "$OPAM_RT_BRANCH"; then
git checkout "$OPAM_RT_BRANCH"
git reset --hard "origin/$OPAM_RT_BRANCH"
else
git checkout master
git reset --hard origin/master
git checkout -b "$OPAM_RT_BRANCH" "origin/$OPAM_RT_BRANCH"
fi

test -d _opam || opam switch create . --no-install --formula '"ocaml-system"'
Expand Down

0 comments on commit 5cf3840

Please sign in to comment.