From d93c14002c3725b856219d5800caeb4dd8d315c1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 21 Jul 2021 15:53:56 -0400 Subject: [PATCH] Fix Circle merge on master branch. There exists a PR on a random fork, which fills in `CI_PULL_REQUEST`, which we don't want to use as merge target when building `master`. Instead, check `CIRCLE_PR_NUMBER`, which is set only on forked PRs. Also, check branch name (which is current, not the _target_) to be certain. --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bb93687c3181..67da798b91e3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,10 +31,10 @@ commands: git remote add upstream git://github.com/matplotlib/matplotlib.git fi git fetch upstream - export merge=${CI_PULL_REQUEST//*pull\//} - if [[ "$merge" != "" ]]; then - echo "Merging ${merge}"; - git pull --ff-only upstream "refs/pull/${merge}/merge"; + if [[ "$CIRCLE_BRANCH" != "master" ]] && \ + [[ "$CIRCLE_PR_NUMBER" != "" ]]; then + echo "Merging ${CIRCLE_PR_NUMBER}" + git pull --ff-only upstream "refs/pull/${CIRCLE_PR_NUMBER}/merge" fi apt-install: