From 9bbea2a351301438438c89316196746b9b80928f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20G=C3=BCnther?= Date: Fri, 20 Sep 2024 11:49:04 +0200 Subject: [PATCH] BUGFIX: Use CIRCLE_BRANCH when we are not triggered by a PR (#3854) --- .circleci/config.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c8ba5a3514..9569a4fea6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -128,7 +128,12 @@ jobs: - run: name: Define target branch command: | - TARGET_BRANCH=$(gh pr view $CIRCLE_PULL_REQUEST --json baseRefName --jq '.baseRefName') + # Get the target branch of the PR but when we are not one a PR, use the current branch + if [ -n "$CIRCLE_PULL_REQUEST" ]; then + TARGET_BRANCH=$(gh pr view $CIRCLE_PULL_REQUEST --json baseRefName --jq '.baseRefName') + else + TARGET_BRANCH=$CIRCLE_BRANCH + fi echo "Target Branch: $TARGET_BRANCH" # Save the variable to BASH_ENV to be able to access it in the next steps echo "export TARGET_BRANCH=$TARGET_BRANCH" >> $BASH_ENV