From 30879db49d15d4e90b92ab359d549a538b1b50b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gu=CC=88nther?= Date: Fri, 20 Sep 2024 11:15:03 +0200 Subject: [PATCH] BUGFIX: Use CIRCLE_BRANCH when we are not triggered by a PR --- .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