diff --git a/.github/scripts/main/main.sh b/.github/scripts/main/main.sh index 6f5385670f5..9dcf821463e 100644 --- a/.github/scripts/main/main.sh +++ b/.github/scripts/main/main.sh @@ -127,6 +127,9 @@ if [ "$OPAM_TEST" = "1" ]; then fi cd $CACHE/opam-rt git fetch origin + if [ "$GITHUB_EVENT_NAME" = "pull_request" ] && git ls-remote --exit-code origin $GITHUB_PR_USER/$BRANCH ; then + BRANCH=$GITHUB_PR_USER/$BRANCH + fi if git ls-remote --exit-code origin $BRANCH ; then if git branch | grep -q $BRANCH; then git checkout $BRANCH diff --git a/.github/workflows/ci.ml b/.github/workflows/ci.ml index 9ff06d19121..d2c33c5414d 100644 --- a/.github/workflows/ci.ml +++ b/.github/workflows/ci.ml @@ -378,7 +378,9 @@ let main_test_job ~analyse_job ~build_linux_job ~build_windows_job:_ ~build_macO let matrix = platform_ocaml_matrix ~fail_fast:false start_latests_ocaml in let host = host_of_platform platform in let ocamlv = "${{ matrix.ocamlv }}" in - job ~oc ~workflow ?section ~runs_on:(Runner [runner]) ~env:[("OPAM_TEST", "1")] ~matrix ~needs ("Test-" ^ name_of_platform platform) + job ~oc ~workflow ?section ~runs_on:(Runner [runner]) + ~env:[("OPAM_TEST", "1"); ("GITHUB_PR_USER", "${{ github.event.pull_request.user.login }}")] + ~matrix ~needs ("Test-" ^ name_of_platform platform) ++ only_on MacOS (install_sys_packages ["coreutils"; "gpatch"] ~descr:"Install gnu coreutils" [MacOS]) ++ checkout () ++ only_on Linux (run "Install bubblewrap" ["sudo apt install bubblewrap"]) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5ee3dc78f71..4bfa4c4c034 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -282,6 +282,7 @@ jobs: fail-fast: false env: OPAM_TEST: 1 + GITHUB_PR_USER: ${{ github.event.pull_request.user.login }} steps: - name: Checkout tree uses: actions/checkout@v4 @@ -336,6 +337,7 @@ jobs: fail-fast: false env: OPAM_TEST: 1 + GITHUB_PR_USER: ${{ github.event.pull_request.user.login }} steps: - name: Install gnu coreutils run: brew install coreutils gpatch