]> granicus.if.org Git - pdns/commitdiff
fix PR checkout in circle-ci testing
authorKees Hoekzema <kees@tweakers.net>
Fri, 10 May 2019 09:18:23 +0000 (11:18 +0200)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Fri, 10 May 2019 11:12:12 +0000 (13:12 +0200)
.circleci/config.yml

index 1f86d52ead003b01a94b97d753fff3935b6d4fd7..aee0e8c4234875ff46ef703f0c46e1d0d7f2b55d 100644 (file)
@@ -12,7 +12,19 @@ commands:
           command: mkdir -p $HOME/.ssh && ssh-keyscan $(echo ${CIRCLE_REPOSITORY_URL} | sed 's,.*@\([^:]*\):.*,\1,') > $HOME/.ssh/known_hosts
       - run:
           name: Clone the repo
-          command: git clone --depth 1 --branch $CIRCLE_BRANCH $CIRCLE_REPOSITORY_URL ~/project
+          command: |
+            if [ -n "$CIRCLE_PR_NUMBER" ]
+            then
+              echo === Checking out PR "$CIRCLE_PR_NUMBER" from "$CIRCLE_REPOSITORY_URL"
+              git clone --depth 1 $CIRCLE_REPOSITORY_URL ~/project
+              cd ~/project
+              git fetch --depth 1 origin +refs/pull/${CIRCLE_PR_NUMBER}/merge
+              git checkout -qf FETCH_HEAD
+            else
+              echo === Checking out branch "${CIRCLE_BRANCH}" from "$CIRCLE_REPOSITORY_URL"
+              git clone --depth 1 --branch $CIRCLE_BRANCH $CIRCLE_REPOSITORY_URL ~/project
+            fi
+            git show -s
 
   auth-regress-setup:
     description: Prepare the environment for auth regression tests