From 2b8dfd168837fe707285cbba0409481cea815369 Mon Sep 17 00:00:00 2001 From: Uv Date: Wed, 6 Dec 2023 18:17:25 -0800 Subject: [PATCH 1/2] Switch to the correct branch for the PR PRs have remote refs. That remote ref will not be automatically fetched when we fetch origin. So how do we fetch it? 1. first fetch the actual remote reference and map it to a "local ref". This is done using git fetch : 2. Then we switch to the ref: git checkout This sets the state of the local clone to what the PR expects it to be --- .github/workflows/tests-via-crave.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-via-crave.yml b/.github/workflows/tests-via-crave.yml index 374d7352adb..a7e6f967a3f 100644 --- a/.github/workflows/tests-via-crave.yml +++ b/.github/workflows/tests-via-crave.yml @@ -18,8 +18,9 @@ jobs: - name: Crave clone sources run: crave clone create --projectID 39 /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER} - name: Checkout the correct branch - run: git -C /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER}/solr checkout ${GITHUB_HEAD_REF} || echo "${GITHUB_HEAD_REF} not present on solr repo, staying at main" - continue-on-error: true + run: | + git -C /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER}/solr fetch ${GITHUB_REF}:${GITHUB_REF} + git -C /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER}/solr checkout ${GITHUB_REF} - name: Initialize, build, test run: | cd /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER}/solr From b849e443ee01bf1aa125f549fc47a0928d291299 Mon Sep 17 00:00:00 2001 From: Uv Date: Wed, 6 Dec 2023 21:16:41 -0800 Subject: [PATCH 2/2] missed the word origin when copy pasting from the other window --- .github/workflows/tests-via-crave.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-via-crave.yml b/.github/workflows/tests-via-crave.yml index a7e6f967a3f..1e8e8843637 100644 --- a/.github/workflows/tests-via-crave.yml +++ b/.github/workflows/tests-via-crave.yml @@ -19,7 +19,7 @@ jobs: run: crave clone create --projectID 39 /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER} - name: Checkout the correct branch run: | - git -C /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER}/solr fetch ${GITHUB_REF}:${GITHUB_REF} + git -C /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER}/solr fetch origin ${GITHUB_REF}:${GITHUB_REF} git -C /crave-devspaces/pipeline/runs/${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER}/solr checkout ${GITHUB_REF} - name: Initialize, build, test run: |